(Create a symlink pytest for py.test)
pytest [options] [file_or_dir] [file_or_dir] ...
Help:
#!/usr/bin/env python | |
import socket | |
import threading | |
import select | |
import sys | |
terminateAll = False | |
class ClientThread(threading.Thread): |
import sys | |
from PySide.QtCore import QObject, Slot | |
from PySide.QtGui import QApplication | |
from PySide.QtWebKit import QWebView | |
html = """ | |
<html> | |
<body> | |
<h1>Hello!</h1><br> |
from multiprocessing.process import Process | |
import time | |
import redis | |
def pub(myredis): | |
for n in range(10): | |
myredis.publish('channel','blah %d' % n) | |
time.sleep(5) | |
def sub(myredis, name): |
# How to upload local db to meteor: | |
# -h = host, -d = database name, -o = dump folder name | |
mongodump -h 127.0.0.1:3002 -d meteor -o meteor | |
# get meteor db url, username, and password | |
meteor mongo --url myapp.meteor.com | |
# -h = host, -d = database name (app domain), -p = password, meteor = the path to the dumped db folder name | |
mongorestore -u client -h production-db-a2.meteor.io.meteor.com:27017 -d myapp_meteor_com -p 'password' meteor/ |
class throttle(object): | |
""" | |
Decorator that prevents a function from being called more than once every | |
time period. | |
To create a function that cannot be called more than once a minute: | |
@throttle(minutes=1) | |
def my_fun(): | |
pass |
#! /usr/bin/python | |
""" | |
To install, you may paste this at your terminal command prompt: | |
mkdir ~/bin | |
wget https://gist.github.com/lukestanley/5922793/raw/hide_firefox_titlebar_on_ubuntu_linux.py | |
mv hide_firefox_titlebar_on_ubuntu_linux.py fixfox; chmod +x fixfox | |
Then, you may simple enter fixfox, to run it. | |
""" |
dc:14:de:8e:d7:c1:15:43:23:82:25:81:d2:59:e8:c0 | 245272 | |
---|---|---|
32:f9:38:a2:39:d0:c5:f5:ba:bd:b7:75:2b:00:f6:ab | 197846 | |
d0:db:8a:cb:74:c8:37:e4:9e:71:fc:7a:eb:d6:40:81 | 152046 | |
34:47:0f:e9:1a:c2:eb:56:eb:cc:58:59:3a:02:80:b6 | 140777 | |
df:17:d6:57:7a:37:00:7a:87:5e:4e:ed:2f:a3:d5:dd | 91904 | |
81:96:a6:8c:3a:75:f3:be:84:5e:cc:99:a7:ab:3e:d9 | 80499 | |
7c:a8:25:21:13:a2:eb:00:a6:c1:76:ca:6b:48:6e:bf | 78172 | |
1c:1e:29:43:d2:0c:c1:75:40:05:30:03:d4:02:d7:9b | 71851 | |
8b:75:88:08:41:78:11:5b:49:68:11:42:64:12:6d:49 | 70786 | |
c2:77:c8:c5:72:17:e2:5b:4f:a2:4e:e3:04:0c:35:c9 | 68654 |
gron
is an incredible tool that makes JSON greppable. But it also makes it diffable, which is great if you have JSON files in Git.
To use gron
to diff JSON in Git, save the json-diff
script below and make it executable. Then add a difftool as shown in gitconfig
, and optionally create an alias to invoke it more easily. Then try it:
git init
echo '{"foo":42,"bar":"hello"}' > foo.json
git add foo.json && git commit -m 'Initial commit.'
""" | |
Convert YouTube subtitles(vtt) to human readable text. | |
Download only subtitles from YouTube with youtube-dl: | |
youtube-dl --skip-download --convert-subs vtt <video_url> | |
Note that default subtitle format provided by YouTube is ass, which is hard | |
to process with simple regex. Luckily youtube-dl can convert ass to vtt, which | |
is easier to process. |