This file contains hidden or 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
s=lambda c=0,l=0:['Mommy','Daddy','Grandma','Grandpa'][c]+' shark'+(', '+' '.join(['doo']*6) if l<3 else '!')+'\n'+('' if c>3 else s(c,l+1) if l<3 else s(c+1,0) if c<3 else '') |
This file contains hidden or 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
brew install cloc | |
cd /to/project/folder | |
cloc . |
This file contains hidden or 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
$ hackon <project_name> | |
# supports autocompletion: | |
$ hackon <TAB><TAB> |
This file contains hidden or 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
function _hackon() { | |
local opts cur prev | |
opts=`ls -l $HOME/projects/ | egrep '^d' | awk '{print $9}'` | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
COMPREPLY=($(compgen -W "${opts}" -- ${cur})) | |
return 0 | |
} | |
function hackon() { |
This file contains hidden or 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 pyrax | |
if __name__ == '__main__': | |
pyrax.set_setting('identity_type', 'rackspace') | |
pyrax.set_credentials('username', 'api_key') | |
cf = pyrax.cloudfiles | |
container = cf.get_container('container_name') | |
objects = container.get_objects(full_listing=True) |
This file contains hidden or 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 pyrax | |
if __name__ == '__main__': | |
pyrax.set_setting('identity_type', 'rackspace') | |
pyrax.set_credentials('username', 'api_key') | |
cf = pyrax.cloudfiles | |
container = cf.get_container('container_name') | |
container.delete_all_objects() |
This file contains hidden or 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
from gevent import monkey | |
from gevent.pool import Pool | |
from gevent import Timeout | |
monkey.patch_all() | |
import pyrax | |
if __name__ == '__main__': | |
pool = Pool(100) | |
pyrax.set_setting('identity_type', 'rackspace') |
This file contains hidden or 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 | |
# original url: https://github.com/funciton/nagios-plugins | |
import urllib2 | |
try: | |
import json | |
except ImportError: | |
import simplejson as json # NOQA | |
UNKNOWN = -1 |
This file contains hidden or 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
class RedisBytecodeCache(BytecodeCache): | |
def __init__(self, conn): | |
self._conn = conn | |
def load_bytecode(self, bucket): | |
code = self._conn.get(bucket.key) | |
if code is not None: | |
return bucket.bytecode_from_string(code) |
This file contains hidden or 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
Color_Off="\[\033[0m\]" # text reset | |
IBlack="\[\033[0;90m\]" # black | |
IRed="\[\033[0;91m\]" # red | |
IGreen="\[\033[0;92m\]" # green | |
IYellow="\[\033[0;93m\]" # yellow | |
# time vars | |
Time12h="\T" | |
PathShort="\w" |
NewerOlder