Skip to content

Instantly share code, notes, and snippets.

View kballenegger's full-sized avatar

Kenneth Ballenegger kballenegger

View GitHub Profile
kballenegger / ihg-english.js
Last active January 3, 2023 06:55
Force IHG to speak English
View ihg-english.js
// ==UserScript==
// @name IHG English
// @namespace
// @version 0.1
// @description Force IHG site to English
// @author Kenneth Ballenegger
// @match*
// @icon
// @grant none
// ==/UserScript==
kballenegger / google-flights-default-USD.js
Last active January 3, 2023 05:20
Force Google Flights to use USD
View google-flights-default-USD.js
// ==UserScript==
// @name Google Flights Default USD
// @version 0.1
// @description Force Google Flights to use USD
// @author Kenneth Ballenegger
// @match*
// @icon
// @grant none
// ==/UserScript==
kballenegger /
Created April 14, 2021 06:02
Crypto utilities for Google Sheets
function main() {
console.log(cryptoPrice("blockstack", "0.1"));
* Sets a random number in P1
* @customfunction
function refresh() {
kballenegger /
Created February 23, 2019 08:02
gc_distance Google Sheets Script
function _tester() {
Logger.log("New test run…")
var result = gc_distance('sfo', 'jfk');
function location_of(airport) {
return data[airport.toUpperCase()];
kballenegger / spotify-star-adder.rb
Created July 14, 2018 01:29
A script to add the currently playing track to a predefined playlist
View spotify-star-adder.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'rspotify'
require 'open3'
require 'uri'
require 'json'
# To use script
# 1/ Create an app at:
kballenegger / shortest-string-path-substitutions.rb
Created July 8, 2017 02:00
Shortest path between strings only substitutions
View shortest-string-path-substitutions.rb
Words ='/usr/share/dict/words') do |file|
file.each do |line|
Alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('')
def path(input, output)
kballenegger / .pryrc
Created July 31, 2015 18:31
[WIP] Hide cluttery auto-generated Rails methods from Pry.
View .pryrc
class ActiveRecord::Base
alias :old_methods :methods
def methods
old_methods.reject do |m|
m = m.to_s
m =~ /(=|_changed\?|_before_type_cast|_was|_change|_will_change!)$/ || \
m =~ /^_/
kballenegger / glossarize.js
Created July 23, 2015 17:08
Automatically insert tooltips on all FlyerTalk pages for airport codes and common terms.
View glossarize.js
var glossary = {
"744":" 747-400",
"(S)RB":"(Sir) Richard Branson",
"*A":"the acronym stands for the Star Alliance.",
"*G":"Star Alliance Gold - Star Alliance status extended to 1Ps and 1Ks (BD*G Diamond Club Gold)",
"*S":"Star Alliance Silver - Star Alliance status extended to 2Ps and 3Ps (BD*S Diamond Club Silver)",
"-lite":"A member that obtains a status level through promotions",
"1K":"United Mileage Plus Premier Executive 1K status. Awarded to members who fly 100,000 actual miles or 100 paid segments.",
"1P":"Premier Executive - 50,000 miles or 60 segments in a calendar year",
"2K, 3K, etc.":"A less formal term to indicate those that have received 200,000 or 300,000 EQM in a year or 200 or 300 EQS in a year.",
kballenegger / present.vim
Created February 5, 2015 10:28
Turns vim into a presentation tool for markdown files with lots of empty newlines between sections
View present.vim
set colorcolumn=0
set nocursorline
set noshowmode
set noshowcmd
set noruler
set laststatus=0
set noswapfile
set nomodifiable
highlight clear OverLength
highlight clear ExtraWhitespace
kballenegger /
Last active August 29, 2015 14:14
Commit (image) a Docker data container.
# this script does not work on OS X
[[ "$(uname -s)" == Darwin ]] && echo "This script cannot run under OS X" && exit 1
container_id="$(docker inspect treasury_dbdata_1 | jq -r '.[0].Id')"