Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Word scrambler
// @namespace https://github.com/blinry
// @description Scrambles words. Based on https://geon.github.io/programming/2016/03/03/dsxyliea
// @include *
// @version 0.1.0
// @grant none
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==
@blinry
blinry / befunge.rb
Created January 8, 2019 14:07
The beginning of a Befunge interpreter for RC pairing interview
# A Befunge interpreter written in Ruby
# Language specification: https://github.com/catseye/Befunge-93/blob/master/doc/Befunge-93.markdown
class ProgramCounter
attr_accessor :x, :y, :dir
def initialize x, y, dir
@x, @y, @dir = x, y, dir
end
end
#!/bin/bash
cd $HOME/permanent/wiki
lastcommittime=$(git show --format="%ct" -s)
nowtime=$(date +%s)
if [ $(($nowtime - $lastcommittime)) -gt $((60*60*24)) ]; then
echo "Autocommit"
git add -A
#!/bin/sh
ID="ten-little-letters"
TARGET="$HOME/work/$ID/"
VERSION="0.10.2"
LOVE="$HOME/tmp/love-${VERSION}-win32.zip"
rm -rf "$ID" "$ID.love" "$ID-win32.zip" "love-${VERSION}-win32" project love
cp -r "$TARGET" project
cd project
@blinry
blinry / mpv-memento.lua
Created October 29, 2017 00:20
Put this into ~/.mpv/scripts/, then press M while playing a movie to turn on "Memento mode"
is_on = false
step = 5*60 -- seconds
overlap = 10 -- seconds
function recalc()
local pos = mp.get_property_number("time-pos")
local duration = mp.get_property_number("duration")
next_seek = math.ceil((pos+1)/step)*step+overlap
if next_seek > duration then
next_seek = duration-1
require 'victor'
scale = 1000 # scale up the result by this factor
first_n = 1 # index of first logo
last_n = 10000 # index of last logo
SCALE = 0.18 # scale up the individual logos by this factor
ALPHA = -15 # for smaller values, logos will shrink faster going out. for positive values, logos will shrink going in.
def get_r i
i**(1/(2.0-ALPHA))
@blinry
blinry / skullsong.rb
Created August 15, 2016 12:28
Skull Song script for LilyPond
pitches = {44 => "gis,,", 45 => "a,,", 46 => "ais,,", 47 => "b,,", 48 => "c,", 49 => "cis,", 50 => "d,", 51 => "dis,", 52 => "e,", 53 => "f,", 54 => "fis,", 55 => "g,", 56 => "gis,", 57 => "a,", 58 => "ais,", 59 => "b,", 60 => "c", 61 => "cis", 62 => "d", 63 => "dis", 64 => "e", 65 => "f", 66 => "fis", 67 => "g", 68 => "gis", 69 => "a", 70 => "ais", 71 => "b", 72 => "c'", 73 => "cis'", 74 => "d'", 75 => "dis'", 76 => "e'", 77 => "f'", 78 => "fis'", 79 => "g'", 80 => "gis'", 81 => "a'", 82 => "ais'", 83 => "b'", 84 => "c''", 85 => "cis''", 86 => "d''", 87 => "dis''", 88 => "e''", 89 => "f''", 90 => "fis''", 91 => "g''", 92 => "gis''", 93 => "a''", 94 => "ais''", 95 => "b''", 96 => "c'''", 97 => "cis'''", 98 => "d'''", 99 => "dis'''", 100 => "e'''", 101 => "f'''", 102 => "fis'''", 103 => "g'''", 104 => "gis'''", 105 => "a'''", 106 => "ais'''", 107 => "b'''", 108 => "c''''", 109 => "cis''''", 110 => "d''''", 111 => "dis''''", 112 => "e''''", 113 => "f''''", 114 => "fis''''", 115 => "g''''", 116 => "gis''''", 117