Skip to content

Instantly share code, notes, and snippets.

@AndrewBelt
AndrewBelt / discord.cpp
Created August 20, 2021 22:22
Discord activity updater
#if defined ARCH_LIN || defined ARCH_MAC
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#endif
#if defined ARCH_WIN
#include <fcntl.h>
#endif
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdint>
#include <algorithm>
#include <time.h>
double getTime() {
struct timespec ts;

Configuring Windows 10 with better privacy, performance, control, and fewer annoyances

As a reasonable computer user, I expect my operating system to not:

  1. send telemetry without my consent. Windows sends Microsoft a massive amount of personal data. [1] [2] [3] [4]
  2. update without my consent. Auto-updating is equivalent to a third-party being able to execute code remotely on my machine where I store private data. Even if an update is not malicious, updates change functionality, and I only want software to change if I know what will change and decide that I want it.
  3. tell me what I can or can't run on my computer. Apple does this w
# Converts an 8-bit RGB PNG to a 16-bit WAV wavetable bank.
# The brightness of the pixel at (x, y) converts to the value of sample x in bank y.
import sys
import os
import numpy as np
import scipy.io.wavfile
import imageio
path = sys.argv[1]
# Audible Instruments Patch File Updater
# Migrates VCV patches from AudibleInstrumentsPreview to AudibleInstruments in bulk
# https://vcvrack.com/AudibleInstruments.html#preview
#
# usage:
# python AudibleInstrumentsUpdater.py path/to/patches/*.vcv
import sys
import json
@AndrewBelt
AndrewBelt / header2source.py
Created May 30, 2018 01:24
Convert C++ headers to boilerplate source files
import sys
import re
import os
header_filename = sys.argv[1]
if not header_filename:
raise "No filename given"
@AndrewBelt
AndrewBelt / zipmerge.sh
Created January 2, 2018 22:10
Merges multiple ZIP files into a single ZIP
#!/bin/bash
OUT_NAME="$1"
shift
IN_NAMES="$@"
TMP_DIR=$(mktemp -d)
# Unzip each input ZIP
for IN_NAME in $IN_NAMES; do
unzip -n "$IN_NAME" -d "$TMP_DIR"
@AndrewBelt
AndrewBelt / panel2source.py
Created November 1, 2017 08:30
for exporting SVG panels to VCV plugin source files
# panel2source.py
# for exporting SVG panels to VCV plugin source files
# Version: 1
# Support contact email: /dev/null
# License: CC0
import sys
import os
import re
# alias alphabet
alias a='aunpack' # extract many archive formats avoiding tarbombs
alias c='printf "\ec"' # clear the screen (also Ctrl-L)
alias f='feh -FZ' # view images fullscreen
alias g='grep -ER' # extended recursive grep
alias i='curl icanhazip.com' # prints IP address
alias l='ls -lh' # detailed ls
alias m='make -j2' # recursive make (adjust to number of cores)
alias p='xclip -selection clipboard -o' # print clipboard
alias r='vim -R' # read-only vim
# pls + gib
# "Securely" transfer files between two computers, assuming the receiver has an accessible IP address
# Instructions:
# Add this to your .bashrc, and restart your terminal.
# Example session
#
# on receiver's terminal: