Skip to content

Instantly share code, notes, and snippets.

View Wheest's full-sized avatar
💭
🍐

Perry Gibson Wheest

💭
🍐
View GitHub Profile
setw -g mode-keys emacs # Use emacs keybindings in copy mode
setw -g status-keys emacs
set -g mouse on
# COPY & PASTE
# Copy tmux buffer to X clipboard
# bind -Tcopy-mode M-w send-keys -X copy-pipe "xclip -i -sel p -f | xclip -i -sel c " . bind-key -n C-y run-shell "xclip -o | tmux load-buffer - ; tmux paste-buffer"
# run -b runs a shell command in background
@Wheest
Wheest / unwind.patch
Created August 8, 2019 09:55
gcc-4.5 patch
--- gcc/config/i386/linux-unwind_old.h 2019-08-08 11:02:37.812459833 +0200
+++ gcc/config/i386/linux-unwind.h 2019-08-08 11:36:20.876351869 +0200
@@ -135,7 +135,7 @@
int sig;
struct siginfo *pinfo;
void *puc;
- struct siginfo info;
+ siginfo_t info;
struct ucontext uc;
} *rt_ = context->cfa;
@Wheest
Wheest / gif_rotate.sh
Created April 18, 2020 12:07
Rotate an animated gif by a chosen amount, while maintaining the animation
#!/bin/bash
# Rotate an animated gif by a chosen amount, while maintaining the animation
if [ "$1" == "-h" ]; then
echo "Usage: `basename $0` [rotation in degrees] [input file] [output file]"
exit 0
fi
ROTATION=$1
@Wheest
Wheest / proof_of_work.py
Created April 19, 2020 08:18
Generate a proof of work for a custom input and prefix, using MD5
from hashlib import md5
import argparse
parser = argparse.ArgumentParser(description='Proof of work')
parser.add_argument('--input_string', default='chungus',
help='String to compute proof of work on')
parser.add_argument('--prefix', default='000',
help='Required prefix for PoW - longer is more difficult')
args = parser.parse_args()
@Wheest
Wheest / random_letters.py
Created September 27, 2021 20:33
Given a dictionary, and a desired fraction, return a list of random letters which at least the desired fraction of words in the dictionary begins with. Optionally, set some letters that *must* appear in the list of letters
#!/usr/bin/env python
import argparse
import string
from typing import List
from collections import Counter
import numpy as np
def main(args) -> List[str]: