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 python3 | |
import base64 | |
""" | |
Simple obfuscation that will obscure things from the very casual observer. | |
It is one of the strongest of the simple ancient ciphers. | |
https://en.wikipedia.org/wiki/Vigenère_cipher | |
""" |
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 re | |
# http://stackoverflow.com/a/13752628/6762004 | |
RE_EMOJI = re.compile('[\U00010000-\U0010ffff]', flags=re.UNICODE) | |
def strip_emoji(text): | |
return RE_EMOJI.sub(r'', text) | |
print(strip_emoji('🙄🤔')) |
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
# curl via proxy with auth | |
curl -x proxy.com:8080 -U user:pass wtfismyip.com/json | |
# Response headers only | |
-I | |
# Measure time | |
-w %{time_total} |
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
# find by name | |
find . -name 'MYTEXT*' | |
# find text in files | |
grep -r "MYTEXT" . | |
# find dir by name | |
find . -name "MYTEXT" -type d | |
# free space |
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
# Reset/checkout a single file from remote origin `branch` | |
git fetch --all | |
git checkout origin/branch -- path/to/file | |
# Reset local repository branch to be just like remote repository HEAD | |
git fetch origin && git reset --hard origin/develop | |
# Update current branch from dev | |
# `git checkout dev; git pull origin dev; git checkout branch; git rebase dev` | |
git pull --rebase origin develop |
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
# http://stackoverflow.com/questions/16073603/how-do-i-update-each-dependency-in-package-json-to-the-latest-version | |
# Use npm-check-updates or npm outdated to suggest the latest versions. | |
npm outdated | |
# If you agree, update. | |
npm update | |
rm -rf node_modules | |
rm npm-shrinkwrap.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
# OSX | |
lsof -i :8000 | |
# Ubuntu | |
sudo netstat -peanut |
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
# Login as a UNIX user (IDENT/PEER authentication) | |
sudo -u postgres psql postgres | |
# Login via PostgreSQL's own managed username/password (TCP authentication) | |
psql username -h 127.0.0.1 -d dbname | |
# Switch to postgres user via root | |
sudo -i -u postgres | |
# Backup DB |
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
# Upgrading all packages with pip | |
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U | |
# Pip freeze for only project requirements.txt | |
pip freeze -r requirements.txt | grep -B100 "pip freeze" | grep -v "pip freeze" > /tmp/requirements.txt && mv /tmp/requirements.txt . |
OlderNewer