# The youtube-dl YouTube URL regex
^
(
(?:https?://)? # http(s):// (optional)
(?:youtu\.be/|(?:\w+\.)?youtube(?:-nocookie)?\.com/|tube\.majestyc\.net/) # the various hostnames, with wildcard subdomains
(?!view_play_list|my_playlists|artist|playlist) # ignore playlist URLs
(?: # the various things that can precede the ID:
(?:(?:v|embed|e)/) # v/ or embed/ or e/
View dump-imap.py
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 | |
#-*- coding:utf-8 -*- | |
import imaplib | |
import getpass | |
import argparse | |
argparser = argparse.ArgumentParser(description="Dump a IMAP folder into .eml files") | |
argparser.add_argument('-s', dest='host', help="IMAP host, like imap.gmail.com", required=True) | |
argparser.add_argument('-u', dest='username', help="IMAP username", required=True) |
View playlist-dl.py
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 shutil | |
import os | |
import sys | |
import subprocess | |
import re | |
# Settings | |
root_folder = 'C:/Users/Robert/Videos/YouTube/Playlists/' | |
destination_regex = re.compile(r'^\[download\] Destination: (.*)$', re.M) |
View redirect-follower.py
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 | |
#-*- coding:utf-8 -*- | |
import sys | |
import urllib2 | |
# This script uses HEAD requests (with fallback in case of 405) | |
# to follow the redirect path up to the real URL | |
# (c) 2012 Filippo Valsorda - FiloSottile | |
# Released under the GPL license |
View HEAD-request.py
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 urllib2 | |
class HeadRequest(urllib2.Request): | |
def get_method(self): | |
return "HEAD" | |
class HEADRedirectHandler(urllib2.HTTPRedirectHandler): | |
""" | |
Subclass the HTTPRedirectHandler to make it use our | |
HeadRequest also on the redirected URL |
View gist:2176911
View gist:2352407
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 HTMLParser | |
class IDParser(HTMLParser.HTMLParser): | |
"""Modified HTMLParser that isolates a tag with the specified id""" | |
def __init__(self, id): | |
self.id = id | |
self.result = None | |
self.started = False | |
self.depth = {} | |
self.html = None |
View Ubuntu-console.txt
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
*** locale.getpreferredencoding() : UTF-8 | |
u'\xe8' è | |
repr(sys.argv[1]) u'\xe8' | |
repr(raw_input()) u'\xe8' | |
*** sys.stdout.encoding : UTF-8 | |
u'\xe8' è | |
repr(sys.argv[1]) u'\xe8' | |
repr(raw_input()) u'\xe8' |
View rasterize.js
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
var page = require('webpage').create(), | |
address, output, size; | |
if (phantom.args.length < 2 || phantom.args.length > 3) { | |
console.log('Usage: rasterize.js URL filename'); | |
phantom.exit(); | |
} else { | |
address = phantom.args[0]; | |
output = phantom.args[1]; | |
page.viewportSize = { width: 1280, height: 1024 }; |
View gist:2667279
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
page.clipRect = page.evaluate(function() { | |
return document.getElementById(ELEMENT_ID).getBoundingClientRect(); | |
}); |
View rtmpdump.log
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
RTMPDump v2.5 GIT-2012-03-31 (Handshake 10 support by Xeebo) | |
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL | |
Connecting ... | |
WARNING: HandShake: Type mismatch: client sent 6, server answered 10 | |
INFO: Connected... | |
ERROR: HandleCtrl: SWFVerification Type 2 request not supported, attempting to use SWFVerification Type 1! Patches welcome... | |
ERROR: RTMP_ReadPacket, failed to read RTMP packet header |
OlderNewer