- Always prefer huge modules (i.e. few big source files) instead of Java's "one class, one file" policy. Or you can use Python packages instead (directory with __init__.py file) to organize multiple files.
- This tutorial about directory structure for Python projects.
- When creating "abstract" classes with some default methods, raise NotImplementedError in the base class. You can do so also with data attributes with @property in the base class like this.
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 argparse | |
import hashlib | |
import logging | |
import subprocess | |
from multiprocessing import Pool, log_to_stderr | |
from os import path, remove, replace, walk | |
from mutagen.mp3 import MP3 | |
parser = argparse.ArgumentParser(description="Floor bitrate of mp3 (and flac) to mp3 to gain storage space, recursively on DIR") |
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
fixiterm () { | |
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist | |
} | |
unfixiterm () { | |
/usr/libexec/PlistBuddy -c 'Delete :LSUIElement' /Applications/iTerm.app/Contents/Info.plist | |
} |
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
git config --global alias.actualize '!CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) && git checkout master && git pull && git checkout $CURRENT_BRANCH && git rebase master' | |
git config --global alias.st status | |
git config --global alias.graph "log --graph --pretty='%C(auto)%cn %d- %h %s (%ar)'" | |
git config --global alias.release '!BRANCH_TO_MERGE="$(git rev-parse --abbrev-ref HEAD)" ; git actualize && git checkout master && git merge --ff-only "$BRANCH_TO_MERGE" && git branch -d "$BRANCH_TO_MERGE"' | |
git config --global color.ui true |
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
class A: | |
def method(self): | |
print "I do stuff..." | |
def uniquemethod(self): | |
print "I'm only in A" |
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
Show hidden characters
{ | |
"shell_cmd": "( workon ${file_base_name} 2>&- && ( echo \"[Using ${file_base_name} virtualenv...]\n\" ; python ${file} ; deactivate ) ) || python ${file}", | |
"selector": "source.python" | |
} |
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
#!/bin/bash | |
autopep=$(autopep8 -dr .) | |
if [[ -z $autopep ]] | |
then | |
echo "> PEP8 passed !" | |
else | |
echo "> PEP8 DID NOT pass !" | |
echo "$autopep" | colordiff |
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
{ | |
"ensure_newline_at_eof_on_save": true, | |
"color_scheme": "Packages/Color Scheme - Default/Amy.tmTheme", | |
"font_face": "Inconsolata", | |
"font_size": 14.0, | |
"gutter": true, | |
"hot_exit": false, | |
"remember_open_files": false, | |
"trim_trailing_white_space_on_save": true, | |
"word_wrap": false, |
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
Matching href without " or ' (with escaping support): | |
(?<=href\=('|"))((?!\1).)+ | |
Matching youtube video URLs without " or ' (with escaping support) | |
(?<=href\=('|"))(((http(s)?:)?//)?(youtube.com))?/watch\?((?!\1).)+ | |
Matching any >1 consecutive empty lines: | |
(?<=\s\n)(\s*\n) | |
Matching per line slash (/) separated values without slashes |