Skip to content

Instantly share code, notes, and snippets.

Avatar
🆒

Patrick Oscity padde

🆒
View GitHub Profile
@padde
padde / load_path_symlink.rb
Last active Aug 29, 2015
Adding lib directory to load path, even when called as a symlink
View load_path_symlink.rb
@padde
padde / inject_jquery.js
Last active Aug 29, 2015
Inject jQuery Bookmarklet
View inject_jquery.js
(function(){
var s = document.createElement('script');
s.setAttribute('src', 'https://code.jquery.com/jquery-latest.min.js');
if (typeof jQuery == 'undefined') {
document.getElementsByTagName('head')[0].appendChild(s);
}
})();
@padde
padde / 5F9D1786.asc.txt
Last active Aug 29, 2015
My PGP Public Key (7B8E 3327 8E52 E3E1 8392 92AE CCBB 382F 5F9D 1786)
View 5F9D1786.asc.txt
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - https://gpgtools.org
mQINBFKjG38BEAC7ahP+UblWBW4MqOwjcFy2KdOS+dBkf77KNUCL4K+uFrmr0g8y
ux1eiTBvNVQ93p4DQIZJulfAS8AlSBHknVcA7RWLEvPt37g6yA2ppWW26ybEM4B/
ixXYMSNVGWKVJP6ce21GBGX/DtNWcjB7B3VB0y3qN1J+hoDOtd9ODoL2Hcl5tlMJ
G3hGK4IbPGIWTIN2YzV/ABondVIvcpn2GkKjcpFivuDubimb75QiwW9C3vF4NMjE
73lUm7ongQkZaBrevgGUXIt/LnEI/Dd7NPWrYDYE4HWa3hlfIHUiDNhr9dnsGT2d
6cuZY3LqRFBx707KQiW9Hv35R1rL5bkHsl8LiS7W/7TZdgNkyKZfBvcQmYSlW8D+
View goto.rb
require 'continuation'
$__labels__ = {}
def label(label)
callcc {|cc| $__labels__[label] = cc }
end
def goto(label)
$__labels__[label].call
View gist:a2a789e504cdbfc739c1
function gitio { curl -fsi git.io -F "url=$1" | grep 'Location' | sed 's/.*: //' | tee >(pbcopy) }
@padde
padde / portcheck.sh
Created Jul 2, 2014
Is port in use?
View portcheck.sh
netstat -anp tcp | awk '$6 ~ "LISTEN" && $4 ~ "22$"'
View travis-status.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def inspect(s):
if s is None:
return '"None"'
return '"' + str(s) + '"'
@padde
padde / array_to_proc.rb
Last active Aug 29, 2015
Pass arguments to Ruby shortcut procs
View array_to_proc.rb
class Array
def to_proc
->(obj) { obj.public_send *self }
end
end
input = <<EOS
foo,bar,baz
hello,world
1,2,3
View open3.rb
require 'open3'
command = 'sh'
Open3.popen2e(command) do |stdin, stdout_and_stderr, wait_thread|
Thread.new do
stdout_and_stderr.each {|l| puts l }
end
stdin.puts 'ls'
@padde
padde / brainfuck.ex
Created Nov 12, 2014
Brainfuck interpreter in Elixir
View brainfuck.ex
# Inspired by these blog posts:
# http://dev.mikamai.com/post/100075543414/elixir-as-a-parsing-tool-writing-a-brainfuck
# http://dev.mikamai.com/post/102283561929/elixir-as-a-parsing-tool-writing-a-brainfuck
defmodule Brainfuck do
@op_decv "-"
@op_incv "+"
@op_decp "<"
@op_incp ">"
@op_putc "."