Skip to content

Instantly share code, notes, and snippets.

View pikesley's full-sized avatar
💭
I fly cargo planes full of rubber dogshit out of Hong Kong

pikesley pikesley

💭
I fly cargo planes full of rubber dogshit out of Hong Kong
View GitHub Profile
@pikesley
pikesley / WAT.rb
Created June 14, 2013 08:24 — forked from pezholio/WAT.rb
require 'nokogiri'
require 'open-uri'
uri = "http://data.gov.uk/dataset/water-framework-directive-lake-waterbodies-wfs"
rdf = nil
doc = Nokogiri::HTML(open(uri))
doc.search('link[rel=alternate]').each do |e|
@pikesley
pikesley / stacktrace
Created September 12, 2013 15:30
'splode
ActionView::Template::Error (undefined method `[]' for nil:NilClass):
24: <div class='control-group'>
25: <%= form.label "#{attribute}_title", class: 'control-label' %>
26: <div class='controls'>
27: <%= form.text_field "#{attribute}_title", class: 'input-xlarge' %>
28: </div>
29: </div>
30:
/var/www/publisher/shared/bundle/ruby/1.9.1/bundler/gems/odi_content_models-5f986f000a66/app/models/attachable_with_metadata.rb:36:in `block (3 levels) in attaches_with_metadata'
actionpack (3.2.13) lib/action_view/helpers/form_helper.rb:1159:in `value_before_type_cast'
==> /var/log/dashboards/dashing-1.log <==
/var/www/dashboards.theodi.org/shared/bundle/ruby/1.9.1/gems/rufus-scheduler-3.0.0/lib/rufus/scheduler.rb:109:in `start_new': this is rufus-scheduler 3.0, use .new instead of .start_new (RuntimeError)
from /var/www/dashboards.theodi.org/shared/bundle/ruby/1.9.1/bundler/gems/dashing-e5f439bbc062/lib/dashing.rb:9:in `<top (required)>'
from config.ru:1:in `require'
from config.ru:1:in `block in <main>'
from /var/www/dashboards.theodi.org/shared/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /var/www/dashboards.theodi.org/shared/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from config.ru:1:in `new'
from config.ru:1:in `<main>'
from /var/www/dashboards.theodi.org/shared/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `eval'
@pikesley
pikesley / gist:7943254
Created December 13, 2013 11:57
Philbot Cuke stack-trace
13 scenarios (13 passed)
72 steps (72 passed)
0m22.574s
[Listen warning]: Change block raised an exception: getaddrinfo: nodename nor servname provided, or not known (SocketError)
Backtrace:
/Users/sam/.rvm/gems/ruby-2.0.0-p353@philbot/gems/excon-0.28.0/lib/excon/socket.rb:135:in `getaddrinfo'
/Users/sam/.rvm/gems/ruby-2.0.0-p353@philbot/gems/excon-0.28.0/lib/excon/socket.rb:135:in `connect'
/Users/sam/.rvm/gems/ruby-2.0.0-p353@philbot/gems/excon-0.28.0/lib/excon/ssl_socket.rb:112:in `connect'
/Users/sam/.rvm/gems/ruby-2.0.0-p353@philbot/gems/excon-0.28.0/lib/excon/socket.rb:28:in `initialize'
/Users/sam/.rvm/gems/ruby-2.0.0-p353@philbot/gems/excon-0.28.0/lib/excon/ssl_socket.rb:8:in `initialize'
source 'https://rubygems.org'
ruby '2.1.0'
#ruby-gemset=diabetes-dashboard
gem 'dashing'
gem 'rake'
gem 'dotenv'
gem 'json'
gem 'httparty'

Keybase proof

I hereby claim:

  • I am pikesley on github.
  • I am pikesley (https://keybase.io/pikesley) on keybase.
  • I have a public key whose fingerprint is DF05 912A 97AF 027E B1FA BF47 E721 358B 2C3F 3A49

To claim this, I am signing this object:

@pikesley
pikesley / gist:b3bc54aa4c262df4ddb9
Last active August 29, 2015 14:02
Say All The Words
#!/bin/bash
say -v ? | sed "s: :%:" | sed "s:\(.*\)%.*:\1:" > /tmp/voices
IFS=$'\r\n' VOICES=($(cat /tmp/voices))
rm /tmp/voices
for WORD in `cat /usr/share/dict/words`
do
VOICE=${VOICES[$RANDOM % ${#VOICES[@]}]}
echo ${VOICE} says ${WORD}
@pikesley
pikesley / converter.rb
Last active August 29, 2015 14:04
Convert .kitchen.yml to attributes for wrapper cookbook
#!/usr/bin/env ruby
require 'yaml'
y = YAML.load File.open ARGV[0]
def walk hash, stack = [], output = []
hash.each do |key, val|
stack << key
if val.is_a?(Hash)
@pikesley
pikesley / Update
Created September 25, 2014 14:06
How to bash
env x='() { :;}; echo vulnerable' bash -c 'echo hello' && sudo apt-get update && sudo apt-get install bash && env x='() { :;}; echo vulnerable' bash -c 'echo hello'
@pikesley
pikesley / gist:33991c36bcf4ed79421b
Last active August 29, 2015 14:08
How do I SoundCloud?

I am mildly bewildered by SoundCloud embeds. I have this page on my band's (Github-hosted) site. Right now, it's using this hacked-together thing to embed those tracks, which is a bit inelegant but works on everything I've tried it on, including various phone browsers.

In an attempt to create a more beautiful solution, I tried using the oEmbed endpoint with this (with the initializer here) which works fine on my desktop browsers, and in Chrome on my Android phone. But on other phone browsers none of the tracks get rendered, unless I request the desktop version, which makes it all work fine (at least on the Android browser, I've had semi-confirmed reports of it working on