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 os | |
import urllib2 | |
import string | |
def clean_path(p): | |
cleaned = p[1:-1].split(".html")[0].split("index")[0] | |
return cleaned if cleaned[-1] == "/" else "%s/" % cleaned | |
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 pyb | |
def set_state(): | |
n = int(pyb.rng() / 2**30 * 6) + 1 | |
[pyb.LED(l).off() for l in range(1,4)] | |
byte_list = list(str(bin(n))[2:]) | |
byte_list.reverse() | |
for led, byte in enumerate(byte_list): | |
if int(byte): | |
pyb.LED(int(led) + 1).on() |
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
commit () { | |
bzr pull && bzr commit -m "$1" && bzr push | |
} |
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
function chpwd() { │ | |
emulate -L zsh │ | |
tree --dirsfirst -L 1 `pwd` > ~/.current_tree │ | |
} |
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
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'handlers': { | |
'error_file': { | |
'level': 'WARNING', | |
'filename': os.path.join(BASE_DIR, 'django-error.log'), | |
'class':'logging.handlers.RotatingFileHandler', | |
'maxBytes': 1 * 1024 * 1024, | |
'backupCount': 2 |
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
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:fccf17e183ef75a5b0b1c58e43cf8dec8aeeb1ee0fb3f6745ba8111fd173b7ea" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
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
""" | |
A locally-hosted web page listing all open http servers. | |
Requirements: | |
nmap (apt-get install nmap) | |
sh, werkzeug (pip install sh, werkzeug) | |
""" | |
from werkzeug.wrappers import Request, Response | |
from sh import nmap | |
print " * Running nmap..." |
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
""" | |
Requires the pip package `SpeechRecognition` | |
The google api seems to only like 15s chuncks | |
""" | |
import speech_recognition as sr | |
import sys | |
r = sr.Recognizer() | |
with sr.WavFile(sys.argv[1]) as source: | |
audio = r.record(source) |
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 | |
""" | |
concicely prints the output of `juju status`. | |
Good for `watch`ing. i.e. `watch -d juju-status` | |
""" | |
import json | |
from subprocess import Popen, PIPE, STDOUT | |
import argparse | |
import sys |
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
todo() { | |
curl -s https://trello.com/1/members/my/cards/\?key\=your-application-key\&token\=your-user-token | jq '.[] | .name' | |
} |
OlderNewer