Skip to content

Instantly share code, notes, and snippets.

View crawsible's full-sized avatar

Colin Jackson crawsible

View GitHub Profile
@crawsible
crawsible / pas_credhub_seeding.sh
Last active February 1, 2018 17:27
PAS CredHub Seeding
# Obtaining the App GUID required when writing the credential to credhub in order to ensure only that App can access the credential.
# 1. Push an application that displays the contents of the VCAP_SERVICES environment variable:
cf target -o apps -s app
cf push credapp
# 2. Fetch the app guid of the pushed app:
cf app credapp --guid
# > <app-guid>

Keybase proof

I hereby claim:

  • I am crawsible on github.
  • I am crawsible (https://keybase.io/crawsible) on keybase.
  • I have a public key ASDUhGG8taQm7l0cHmaO2BI-aaIkj_5umEs7usIFNfC0-wo

To claim this, I am signing this object:

@crawsible
crawsible / switchkb
Last active March 26, 2016 21:01
A script for toggling the alt/win keyboard swap in GNOME settings.
#!/usr/bin/env bash
OLD_KBOPTS=`gsettings get org.gnome.libgnomekbd.keyboard options`
TOGGLE_OP="altwin\taltwin:swap_alt_win"
if [[ $OLD_KBOPTS == *"$TOGGLE_OP"* ]]
then
OP="-"
echo "Unswapping alt and win..."
else
#!/usr/bin/env ruby
File.readlines(ARGV[0]).each do |line|
branch = line.split(/\s/).first
puts "current branch:"
puts branch
puts `git log #{branch} --pretty=fuller -1`
puts "delete? Y/n"
res = $stdin.gets.chomp.downcase
PgSearch.multisearch_options = {
using: {
tsearch: { prefix: true }
}
}
@crawsible
crawsible / sassteroidVelocityUpdate.js
Created October 14, 2014 06:16
Our velocity update function for the sweet new game, "Sassteroids"
Sassteroid.prototype.updateVelocity = function (that, maxDimensions) {
var dotProd = Sassteroids.Utils.dotProduct;
var perpVec = Array(2);
var uSpeed = Math.sqrt(dotProd(this.vel, this.vel));
var vSpeed = Math.sqrt(dotProd(that.vel, that.vel));
var posVector = Array(2);
for (var i = 0; i < 2; i++) {
posVector[i] = that.pos[i] - this.pos[i];
@crawsible
crawsible / parse_www_encoded_form.rb
Last active August 29, 2015 14:07
parsing string formatted as rails-style nested params Hash
def parse_www_encoded_form(www_encoded_form)
URI.decode_www_form(www_encoded_form).each do |pair|
# returns array of names between '[' and ']' characters
key_parts = pair.first.split(/\]\[|\[|\]/)
current_hash = @params
new_key = key_parts.shift
# this does not run unless key_parts.count > 1
until key_parts.empty? do
@crawsible
crawsible / run-away
Created May 24, 2014 15:11
A command-line game written without any libraries or frameworks beyond those included in the python install.
#!/usr/bin/python3
import time
from random import randint
from subprocess import call
DIRECTION_ICONS = ["∩", "⊂", "∪", "⊃"]
DIRECTION_ICONS_ACTIVE = ["▲", "◀︎", "▼", "▶︎"]
SIZE = 19
@crawsible
crawsible / titleparser.py
Created May 24, 2014 15:06
A little command-line tool to run through a CSV of post titles and identify which of them are people looking to buy an item.
#!/usr/local/bin/python3
import sys
import csv
BUYER_CONSTANTS = ('WTB', 'Wtb', 'WANTED', 'Wanted', 'wanted', 'LOOKING FOR',
'Looking for', 'looking for', 'TO BUY', 'to buy')
class TitleParser(object):