Skip to content

Instantly share code, notes, and snippets.

@miyl
miyl / hyprland-monitor-toggle.sh
Last active January 20, 2025 22:23
A hyprland script for a laptop-external-monitor setup, toggling between which is in use
#! /usr/bin/env sh
# A hyprland script for a laptop-external-monitor setup, toggling between which is in use
# Launch at startup to make hyprland disable the internal monitor if an external monitor is detected and enabled
# Additionally it's called with a keybind to switch between a laptop monitor and an external display
# Ideally the conditional monitor behaviour was instead done directly in hyprland.conf, but I'm not sure whether that's possible
#
# Relevant info:
# - hyprctl monitors: identifies currently enabled monitors
@nivethan-me
nivethan-me / README.md
Last active January 20, 2025 22:22
Add Cloudflare Custom Domain to Vercel

Add Cloudflare custom domain to Vercel

  1. Sign up and sign in to Cloudflare https://dash.cloudflare.com/sign-up.
  2. In your Cloudflare dashboard, select the Domain Registration > Register Domains tab.
  3. Search for your favorite domain and purchase it. In my case, I purchased the domain https://nivethan.me/ for my portfolio.
  4. Sign in to Vercel and go to your dashboard, where you can see all your projects in the Overview tab.
  5. Click on a project and on the top right, select Domains.
  6. Type your domain in the text box, e.g., nivethan.me, and click Add.
  7. Select the recommended option: Add www.nivethan.me and redirect nivethan.me to it.
  8. Vercel will show an invalid configuration under your domains and display the relevant A record IP under nivethan.me and a CNAME IP under www.nivethan.me. These need to be set up on Cloudflare to make it work.
@ph33nx
ph33nx / WinMasterBlocker.bat
Last active January 20, 2025 22:22
Block All Adobe .exe files via Firewall on Windows Using Batch Script | Stop adobe apps to access internet
:: ################################################################
:: ## 🔥 WinMasterBlocker 🔥 #
:: ################################################################
:: # Author: https://github.com/ph33nx #
:: # Repo: https://github.com/ph33nx/WinMasterBlocker #
:: # #
:: # This script blocks inbound/outbound network access #
:: # for major apps like Adobe, Autodesk, Corel, Maxon, #
:: # and more using Windows Firewall. #
:: # #
@Deep-unlearning
Deep-unlearning / try_moonshine.py
Last active January 20, 2025 22:17
Use moonshine on transformers
from transformers import AutoProcessor, MoonshineForConditionalGeneration
from datasets import load_dataset
processor = AutoProcessor.from_pretrained("UsefulSensors/moonshine-tiny")
model = MoonshineForConditionalGeneration.from_pretrained("UsefulSensors/moonshine-tiny")
ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
inputs = processor([ds[0]["audio"]["array"], ds[0]["audio"]["array"]], return_tensors="pt")
input_values = inputs.input_values

Configuração de regras udev para RP2040

Este tutorial é destinado a usuários de Linux que encontraram erros de permissão ao programar para o Raspberry Pi Pico no VS Code utilizando a extensão "Raspberry Pi Pico".

Os erros que tive foram tentar executar um código para o pico e monitorar o serial monitor

Passo 1: Criar um novo arquivo de regras udev

Abra um editor de texto para criar um novo arquivo de regras udev:

@Vitorbnc
Vitorbnc / stm32_gpio_registers_and_c_bitwise.md
Created August 17, 2016 01:00
How to set bits in C and write to STM32 GPIO registers using Arduino IDE

STM32duino GPIO Registers and Programming

Bit Setting in C

Setting a bit

Use the bitwise OR operator ( | ) to set a bit.

number |= 1 << x;
@Stanback
Stanback / nginx.conf
Last active January 20, 2025 22:12 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@fnky
fnky / ANSI.md
Last active January 20, 2025 22:11
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@lanedraex
lanedraex / listener.rs
Created November 5, 2017 09:12
Rust UDP socket: send and receive
use std::net;
use std::env;
fn listen(socket: &net::UdpSocket, mut buffer: &mut [u8]) -> usize {
let (number_of_bytes, src_addr) = socket.recv_from(&mut buffer).expect("no data received");
println!("{:?}", number_of_bytes);
println!("{:?}", src_addr);
@FronkonGames
FronkonGames / TinyTween.cs
Created October 30, 2022 23:20
A Complete and Easy to use Tweens library in One File.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// _____ _ _____
// |_ _|_|___ _ _ |_ _|_ _ _ ___ ___ ___
// | | | | | | | | | | | | | -_| -_| |
// |_| |_|_|_|_ | |_| |_____|___|___|_|_|
// |___|
// A Complete and Easy to use Tweens library in One File
//
// Basic use: