View outlook_proxy.rb
1 2 3 4 5 6 7 8 9 10
require 'openssl'
require 'socket'
 
Thread.abort_on_exception = true
 
server = TCPServer.new(1993)
n = 0
loop do
client = server.accept
n += 1
View 0_enumerator.rb
1 2 3 4 5 6 7 8 9 10
class Benerator
def initialize(&block)
@block = block
end
 
def next
as_array.shift
end
 
def as_array
View alias.rb
1 2 3 4 5 6 7 8 9 10
class Parent
def foo
"Parent#foo"
end
alias :bar :foo
end
 
class Child < Parent
def foo
"Child#foo"
View python.py
1 2 3 4 5 6 7
def foo(a=[]):
a.append(1)
return a
 
foo() # => [1]
foo() # => [1, 1]
foo() # => [1, 1, 1]
View gist:4b8fa67efb8e0c650fbc
1 2 3 4 5 6 7 8 9 10
{
"java": {
"jdk_version": "7",
"oracle": {"accept_oracle_download_terms": "true"},
"accept_license_agreement": "true",
"install_flavor": "oracle"
},
"elasticsearch": {
"nginx": {
"users": [{"username": "salesloft", "password": "<haha you wish>"}],
View sqrtSums.hs
1 2
sqrtSums :: Double -> Int
sqrtSums x = length (takeWhile (<x) (scanl1 (+) (map sqrt [1..]))) + 1
View gist:7807702
1 2 3 4 5
$ time ls -lh > ~/files.txt
 
real 186m14.030s
user 0m9.361s
sys 43m37.939s
View gist:7356242
1 2 3 4 5 6 7 8 9 10
ve() {
local curdir ve
curdir="$PWD"
[ -z "$1" ] && ve="ve" || ve="$1"
while ! ls -d "$ve" >/dev/null 2>&1; do
if [ "$PWD" == "/" ]; then
echo "Cannot find a '$ve' directory on the current path" >&2
cd $curdir
return -1
fi
View gist:5214764
1 2 3
[alias]
pep8 = !git status -s | awk '{print $2}' | grep '.py' | xargs pep8
pyflakes = !git status -s | awk '{print $2}' | grep '.py' | xargs pyflakes
View regexen.rb
1 2 3 4 5 6 7 8 9 10
class Regexen
def initialize(a={})
a.default_proc = proc { |h,k| [] }
@good = a[:good]
@bad = a[:bad]
end
def good=(r)
@good << r
end
def bad=(r)
Something went wrong with that request. Please try again.