Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am gadtfly on github.
* I am gadtfly (https://keybase.io/gadtfly) on keybase.
* I have a public key ASB-BuXUlDsB6cQ6xkZv1xQOcfH9o69jWoykyRRjcGQFeAo
To claim this, I am signing this object:
@gadtfly
gadtfly / prelude.js
Last active May 10, 2019 15:10
Play the FF Prelude on your PC speaker, because why not. Requires `beep`.
const child_process = require('child_process');
const beep = (f, l) => { child_process.spawnSync('beep', ['-f', f, '-l', l]); };
const freq_for_note = (root_freq, step, steps_per_octave = 12) => root_freq * 2**(step/steps_per_octave);
const invert_chord = (steps, steps_per_octave = 12) => steps.slice(1).concat(steps[0] + steps_per_octave);
const rangeTo = n => [... Array(n).keys()];
const note_length = 60*1000/320;
const root_freq = freq_for_note(440, 3 - 3*12); // C2 derived from A440
@gadtfly
gadtfly / headphone-plug
Last active June 23, 2023 17:41
Automatically switch Linux PulseAudio output between an HDMI output and a headphone jack (apparently necessary when they are on seperate cards)
event=jack/headphone
action=/etc/acpi/headphone-plug.py %e
import Data.List
import Control.Monad
cards = [4,5,5,6,6]
score :: (Num a, Eq a) => [a] -> Int
score cards = fifteenScore + pairScore + runScore
DEFAULT_CPU=15
CPU=${1:-$DEFAULT_CPU}
PID=$(ps -A | grep -m1 Isaac | awk '{print $1}')
sudo cputhrottle $PID $CPU
@gadtfly
gadtfly / tag_renamer.rb
Last active January 19, 2017 00:35
After the fact, realized that iTunes already does what I was starting to suspect I ultimately wanted out of this, so this probably won't be any further refined. But worked for task at hand.
require 'optparse'
require 'taglib'
def parse_options(argv)
{dry_run: false}.tap do |options|
OptionParser.new do |parser|
parser.banner = "Usage: tag_renamer.rb [options] FORMAT FILES"
parser.separator ""
parser.separator "Example:"
parser.separator " ruby tag_renamer.rb -n \"artist - title\" \"Chapo Bonus Episodes\"/*.m*"
@gadtfly
gadtfly / latency.visualizer.html
Last active September 7, 2016 08:08
I was curious about how the different input latencies in TVs I was looking at would manifest in shooter games. This was small result.
<html>
<head>
<style>
body {
cursor: crosshair;
}
.follower{
position: fixed;
font-family: sans-serif;
font-size: 1.5rem;
function mod(x,y) {
return ((x % y) + y) % y;
}
function VigenèreCipher(key, alphabet) {
this.keystream = function*() {
while(true) {
yield* key.split('');
}
};
@gadtfly
gadtfly / index.html
Last active June 17, 2024 20:00
Quick-and-dirty, relatively simple, media sharing with remote iOS devices via Amazon S3 and VLC
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script>
var bucket = window.location.host.split('.')[0] || parse_querystring(window.location).bucket
var url_for = parse_querystring(window.location).download ? c : vlc_url
document.addEventListener('DOMContentLoaded', function(){
ajax('GET', s3_url(bucket), function(event){

###Short answer:

The instructions are out of date, but there is no sufficiently significant difference between 4.2.5 and 4.2.6 to worry about it.

Either do bundle update (which should make everything able to use 4.2.5), or (as you figured) revert to the original specification you found in your Gemfile (ie, change the line back to gem 'rails', '4.2.6')