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
# Mock logging | |
# File - someclass.py | |
class SomeClass(object): | |
def method_man(self): | |
logging.basicConfig(filename='/tmp/somelog.log', | |
level=logging.INFO, | |
format='%(asctime)s | %(message)s', | |
datefmt='%m/%d/%Y %I:%M:%S') |
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
cat /etc/passwd | awk -F: '{print "crontab -u "$1" -l"}' |s |
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
# To use a custom decoractor with fabric | |
# the decorator needs @wraps(func) otherwise | |
from functools import wraps | |
def lock_hubot_aws_changes_when_running(func): | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
print 'do something' | |
result = func(*args, **kwargs) | |
print 'do something' |
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
#Bash | |
alias pwgen='env LC_CTYPE=C tr -dc "a-zA-Z0-9-_" < /dev/urandom | head -c 15' | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\[$(tput bold)\]\[$(tput setaf 5)\]⌘ \[$(tput setaf 6)\]\w\[$(tput setaf 3)\]\$(parse_git_branch) \[$(tput sgr0)\]" | |
# Git config... |
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
# Package up new box | |
vagrant package --base /Users/<USER>/VirtualBox VMs/<VM-NAME> --output mybox.box | |
vagrant box add foobar mybox.box |
OlderNewer