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
# Setup some colors to use later in interactive shell or scripts | |
export COLOR_NC='\e[0m' # No Color | |
export COLOR_WHITE='\e[1;37m' | |
export COLOR_BLACK='\e[0;30m' | |
export COLOR_BLUE='\e[0;34m' | |
export COLOR_LIGHT_BLUE='\e[1;34m' | |
export COLOR_GREEN='\e[0;32m' | |
export COLOR_LIGHT_GREEN='\e[1;32m' | |
export COLOR_CYAN='\e[0;36m' | |
export COLOR_LIGHT_CYAN='\e[1;36m' |
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
[user] | |
name = <user.name> | |
email = <user.email> | |
[merge] | |
tool = vimdiff | |
[color] | |
ui = auto | |
[color "branch"] | |
current = yellow reverse |
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
# encoding: UTF-8 | |
import sys | |
import datetime | |
class ProgressBarError(Exception): | |
pass | |
class AlreadyFinishedError(ProgressBarError): | |
pass |
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
def author_email(author): | |
""" | |
returns email address of given author. | |
If any of <,> sign are found, it fallbacks to regex findall() | |
and returns first found result or empty string | |
Regex taken from http://www.regular-expressions.info/email.html | |
""" | |
import re | |
r = author.find('>') |
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
""" | |
This script fetches page from wikipedia, parses it, and outputs | |
top domain names in json format. | |
TODO: Need to add unicode versions of internationalized codes... | |
""" | |
import json | |
import urllib2 | |
from lxml.html import fromstring |
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 sys | |
import unittest | |
import jinja2 | |
# sys._getframe works on CPython and PyPy. Not tested elsewhere | |
rs = lambda text: text.format(**sys._getframe(1).f_locals) | |
def rj(text): | |
template = jinja2.Template(text) |
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
07-18 17:00:36.059 1691 1691 D dalvikvm: GC_EXPLICIT freed 16K, 15% free 2743K/3203K, paused 1ms+1ms | |
07-18 17:00:36.071 253 258 I SubMicro: sdv/00 0a 92 | |
07-18 17:00:41.087 496 496 D dalvikvm: GC_EXPLICIT freed 133K, 17% free 2876K/3463K, paused 1ms+2ms | |
07-18 17:00:42.635 722 722 I CecSS : Start key listening | |
07-18 17:00:42.635 722 722 I CecSS : [CecSourceService] onStartCommand: action=action_Interval | |
07-18 17:00:45.063 3370 3370 D AndroidRuntime: | |
07-18 17:00:45.063 3370 3370 D AndroidRuntime: >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<< | |
07-18 17:00:45.063 3370 3370 D AndroidRuntime: CheckJNI is OFF | |
07-18 17:00:45.171 3370 3370 D AndroidRuntime: Calling main entry com.android.commands.pm.Pm | |
07-18 17:00:45.207 1662 1668 D dalvikvm: GC_EXPLICIT freed 4K, 17% free 2669K/3203K, paused 1ms+0ms |
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 | |
""" | |
I couldn't register at www.freesound.org so I wrote this little script to make | |
downloading sounds from their site easy. | |
Usage | |
----- | |
getfreesound.py URL |
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
def import_obj(obj_path): | |
""" | |
Returns object from the given path. | |
For example, in order to get function located at | |
``os.path.abspath``: | |
abspath = import_obj('os.path.abspath') |
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 | |
from Foundation import NSUserNotification | |
from Foundation import NSUserNotificationCenter | |
from Foundation import NSUserNotificationDefaultSoundName | |
from optparse import OptionParser | |
def main(): | |
parser = OptionParser(usage='%prog -t TITLE -m MESSAGE') |
OlderNewer