Skip to content

Instantly share code, notes, and snippets.

View elprup's full-sized avatar

elprup elprup

View GitHub Profile
@mivade
mivade / pyqtornado.py
Last active April 11, 2016 03:18
PyQt with Tornado
"""Demonstration of combining the Qt and Tornado event loops."""
from PyQt4 import QtGui, QtCore
from tornado.ioloop import IOLoop
from tornado import gen
from tornado.httpclient import AsyncHTTPClient
URL = "https://www.random.org/integers/?num=1&min=100&max=999&col=1&base=10&format=plain&rnd=new"
class MainWindow(QtGui.QMainWindow):
@gitaarik
gitaarik / git_submodules.md
Last active July 8, 2024 16:25
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@FZambia
FZambia / sub.py
Last active October 21, 2019 06:47
tornado's Subprocess class usage example. Minimal Tornado's version required - 3.1
from __future__ import print_function
from tornado.gen import Task, Return, coroutine
import tornado.process
from tornado.ioloop import IOLoop
import subprocess
import time
STREAM = tornado.process.Subprocess.STREAM
make all-recursive
make[1]: Entering directory `/home/doug/repos/facebook/scribe'
Making all in .
make[2]: Entering directory `/home/doug/repos/facebook/scribe'
make[2]: Nothing to be done for `all-am'.
make[2]: Leaving directory `/home/doug/repos/facebook/scribe'
Making all in src
make[2]: Entering directory `/home/doug/repos/facebook/scribe/src'
/usr/local/bin/thrift -o . -I /usr/local/share/ --gen cpp:pure_enums --gen py --gen php --gen java ../if/scribe.thrift
/usr/local/bin/thrift -o . -I /usr/local/share/ --gen cpp:pure_enums --gen py --gen php --gen java ../if/bucketupdater.thrift
@vsajip
vsajip / sphinx-reload.py
Created January 27, 2012 22:05 — forked from delijati/sphinx-reload.py
watchdog example
# Run:
# $ virtualenv env
# $ cd env
# $ env/bin/pip install watchdog
# $ env/bin/pip install selenium
# $ env/bin/python sphinx-reload.py
import logging
import os
import selenium.webdriver
@ipconfiger
ipconfiger / __init__.py
Created January 5, 2012 12:48
OAuth包,实现了sina,QQ,网易,搜狐的OAuth认证
# -*- Encoding: utf-8 -*-
import base64
import binascii
import cgi
import hashlib
import hmac
import logging
import time
import urllib
import urlparse
@maximebf
maximebf / webtail.py
Created October 21, 2011 13:25
Web tail / tail -f as a webpage using websocket
#!/usr/bin/python
# Equivalent of "tail -f" as a webpage using websocket
# Usage: webtail.py PORT FILENAME
# Tested with tornado 2.1
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
import tornado.httpserver
@kennethreitz
kennethreitz / 0_urllib2.py
Created May 16, 2011 00:17
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()