This file contains hidden or 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
class FlvFormater(tornado.web.RequestHandler): | |
@tornado.web.asynchronous | |
def get(self, video_name): | |
self.set_header("Content-Type", "video/x-flv") | |
cmd = "/usr/local/bin/ffmpeg -i %s -f flv -acodec aac -s vga -"%video_name | |
self.ioloop = tornado.ioloop.IOLoop.instance() | |
self.pipe = cmdfd = os.popen(cmd) | |
#self.pipe = cmdfd = open("a.avi", "r") | |
self.ioloop.add_handler( cmdfd.fileno(), self.async_callback(self.on_read), self.ioloop.READ ) |
This file contains hidden or 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
/* | |
CMakeLists.txt file: | |
cmake_minimum_required(VERSION 2.6) | |
project(wiispeak) | |
include_directories("/usr/include/libcwiimote/") | |
find_library(cwiimote cwiimote PATHS /usr/lib) | |
find_library(bluetooth bluetooth PATHS /usr/lib) |
This file contains hidden or 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 os, sys, re, cookielib, urllib2, random, logging | |
import datetime | |
import urllib | |
import time | |
import socket | |
from BeautifulSoup import BeautifulSoup | |
from threading import Thread | |
MEGAREGEX = '.*megavideo\.com.*v=([A-Za-z0-9]+).*' | |
DEBRIDREGEX = '.*(http://.+key=[a-z0-9-A-Z]+).*' |
This file contains hidden or 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 | |
def fetch_page(url): | |
opener = urllib2.build_opener() | |
request = urllib2.Request(url) | |
datafd = opener.open(request) | |
return datafd.read() |
This file contains hidden or 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 logging | |
import urllib2 | |
import cookielib | |
class WebDownloader(object): | |
def __init__(self): | |
self.cookiemgr = cookielib.LWPCookieJar() | |
self.cookiefile = 'cookies.dat' |
This file contains hidden or 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 BigFileDownloader(object): | |
def __init__(self, url, file): | |
self.packet_size = 128 | |
self.urlopener = urllib2.build_opener() | |
self.url = url | |
self.file = file |
This file contains hidden or 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 sys | |
import urllib2 | |
import datetime | |
import time | |
import socket | |
import logging | |
from threading import Thread | |
socket.setdefaulttimeout(10000) |
This file contains hidden or 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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#ifdef HAVE_AV_CONFIG_H | |
#undef HAVE_AV_CONFIG_H | |
#endif | |
#include "libavcodec/avcodec.h" |
This file contains hidden or 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 sys | |
import fnmatch | |
import logging | |
import subprocess | |
def Logger(): | |
return logging.getLogger("post-recieve-hook") | |
This file contains hidden or 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 random | |
_init=lambda: "This is my value (%i)" % random.randrange(0, 100) | |
_my=_init() | |
get=lambda: _my | |
if __name__ == "__main__": # A minimal test. | |
myvalue=get() | |
for _ in xrange(0, 100): assert(get() == myvalue) |