This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
cache = {0: 0, 1: 1} | |
def fib(n): | |
if n in cache: | |
return cache[n] | |
f = fib(n - 1) + fib(n - 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
ec2-autoscale-instance.py | |
Read Autoscale DNS from AWS | |
Sample config file, | |
{ | |
"access_key": "key", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# converted from http://stackoverflow.com/a/19801386/20774 | |
# Much more efficent then my initial pass | |
require 'set' | |
def palindromes(input) | |
result = Set.new | |
input.size.times do |i| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
date=`date "+%Y-%m-%dT%H_%M_%S"` | |
backup_home=/mnt/storage/rsync-backup | |
rsync -azxqP \ | |
--delete \ | |
--link-dest=$backup_home/current \ | |
--exclude='.gvfs' \ | |
--delete-excluded \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
''' | |
Copyright 2009, The Android Open Source Project | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import skillz.* | |
import skillz.admin.* | |
def quartzScheduler = ctx.getBean('quartzScheduler') | |
quartzScheduler.start() | |
GameMetricsJob.triggerNow() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'bcrypt' | |
print BCrypt::Password.create ARGV.shift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# level one | |
def foo(fn): | |
def inner(): | |
return 'foo' + fn() | |
return inner | |
@foo | |
def bar(): | |
return 'bar' | |
# level two |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'json' | |
get '/hi' do | |
"Hello World!" | |
end | |
get '/json' do | |
content_type :json | |
{ :key1 => 'value1', :key2 => 'value2' }.to_json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
git filter-branch --index-filter 'git rm --cached --ignore-unmatch '$1'' --prune-empty --tag-name-filter cat -- --all | |
rm -rf .git/refs/original/ | |
git reflog expire --expire=now --all | |
git gc --prune=now | |
git gc --aggressive --prune=now |