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 | |
say() | |
{ | |
mplayer -really-quiet -ao alsa "http://translate.google.com/translate_tts?tl=it&q=$*" | |
} | |
say $* |
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 httplib2 as http | |
import json | |
try: | |
from urlparse import urlparse | |
except ImportError: | |
from urllib.parse import urlparse | |
headers = { | |
'Accept': 'application/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
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core? | |
L.TileLayer.Common = L.TileLayer.extend({ | |
initialize: function (options) { | |
L.TileLayer.prototype.initialize.call(this, this.url, options); | |
} | |
}); | |
(function () { | |
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 | |
import subprocess | |
import optparse | |
import re | |
#Create variables out of shell commands | |
#Note triple quotes can embed Bash | |
#You could add another bash command here | |
#HOLDING_SPOT="""fake_command""" |
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
sudo apt-get install python2.7 | |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 20 | |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10 | |
sudo update-alternatives --set python /usr/bin/python2.6 | |
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 funct(list1, list2): | |
assert isinstance(list1, list) and isinstance(list2, list) |
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
if verbose: | |
def verboseprint(*args): | |
# Print each argument separately so caller doesn't need to | |
# stuff everything to be printed into a single string | |
for arg in args: | |
print arg, | |
else: | |
verboseprint = lambda *a: None # do-nothing function |
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
if sys.version_info < (2, 6): | |
print('ERROR: %s' % sys.exc_info()[1]) | |
print('ERROR: this script requires Python 2.6 or greater.') | |
sys.exit(101) |
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 logging.config | |
logging.config.fileConfig('logging.conf') | |
log = logging.getLogger(__name__) |
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
###################################################################### | |
# CURRENT AWARE LOCAL DATETIME | |
###################################################################### | |
from datetime import datetime | |
from tzlocal import get_localzone | |
local_tz = get_localzone() | |
local_dt = datetime.now(local_tz) |
OlderNewer