Skip to content

Instantly share code, notes, and snippets.

@bisby
bisby / pbedit
Created June 27, 2018 20:16
Clipboard Editing Made Easy
#!/bin/bash
set -eo pipefail
# Move clipboard into vim
pbpaste > /tmp/vim-scratch
vim -c "set nofixendofline" /tmp/vim-scratch
# Move vim back into clipboard
cat /tmp/vim-scratch | pbcopy
function giteach {
REPODIR=~/repos
for REPO in `ls $REPODIR`; do
echo "Performing \"git $@\" on $REPO";
git -C $REPODIR/$REPO $@
done
}
DECLARE i INT;
DECLARE cur CURSOR FOR SELECT blog_id FROM wp_blogs;
OPEN cur;
read_loop: LOOP
FETCH cur INTO i;
IF done THEN
LEAVE read_loop;
END IF;
import sys, binascii, string, re
import xml.etree.ElementTree
def decrypt(encoded):
key = 0x398e27fc50276a656065b0e525f4c06c04c61075286b8e7aeda59da9813b5dd6c80d2fb38068773fa59ba47c17ca6c6479015c1d5b8b8f6b9a
output = hex(key^(int(encoded, 16)))
binary_output = binascii.unhexlify(output[2:116]) # needed to drop the 0x at the beginning
return (binascii.b2a_qp(binary_output[0:40]), binascii.b2a_qp(binary_output[40:57]))

Keybase proof

I hereby claim:

  • I am bisby on github.
  • I am nickbisby (https://keybase.io/nickbisby) on keybase.
  • I have a public key whose fingerprint is EEE0 A429 ECBE 304D 2E23 D0F9 803E BBA8 B4B7 6ADD

To claim this, I am signing this object:

(fn [a b]
(letfn [
(x [func args] (if (< 0 (count args))
(cons
(func (first args))
(lazy-seq (x func (rest args))))))]
(x a b)))
@bisby
bisby / terariafix.sh
Created August 11, 2015 19:26
Terraria Lib Fix - Obsolete
#!/bin/bash
#Putting this here for posterity. This has been fixed
TERRARIA_LOC=/home/bisby/gamedisk/SteamLibrary/steamapps/common/Terraria
mv $TERRARIA_LOC/lib64/libmonosgen-2.0.so.0 $TERRARIA_LOC/lib64/libmonosgen-2.0.so.0.bak
ln -s /usr/lib64/libmonosgen-2.0.so.1.0.0 $TERRARIA_LOC/lib64/libmonosgen-2.0.so.0
mv $TERRARIA_LOC/mscorlib.dll $TERRARIA_LOC/mscorlib.dll.bak
@bisby
bisby / battle-net.desktop
Last active August 29, 2015 14:26
Battle.net Launcher
[Desktop Entry]
Version=1.0
Type=Application
Name=Battle.net
Comment=Play Blizzard games
Icon=4F3B_Battle.net Launcher.0
Exec=env winearch=win64 WINEPREFIX="/home/nbisby/.wine64" wine "/mnt/megatron/Programs/Battle.net/Battle.net Launcher.exe"
Path=/home/nbisby/gamedisk/Battle.net
NoDisplay=false
Categories=Game;
@bisby
bisby / factorize.rb
Last active August 29, 2015 14:21
KenKen Factorizor
require 'prime'
def factorize x
factors = []
if x == 1 then return factors end
while !Prime.prime? x
lf = lowestFactor x
factors.push lf
x = x/lf
end
@bisby
bisby / geometric.php
Created May 21, 2015 20:59
Geometric example
<?php
function sum($callback, $range) {
return array_reduce($range, function($carry, $item) use ($callback) {
return $carry + $callback($item);
});
}
$test = function($x) { return (float) 1/$x; };
$y = sum($test, range(1, 3)); // 1/1 + 1/2 + 1/3 = 11/6