In Git you can add a submodule to a repository. This is basically a sub-repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:
- Separate big codebases into multiple repositories.
| """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): |
| 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 |
| # 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 |
| # -*- Encoding: utf-8 -*- | |
| import base64 | |
| import binascii | |
| import cgi | |
| import hashlib | |
| import hmac | |
| import logging | |
| import time | |
| import urllib | |
| import urlparse |
| #!/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 |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import urllib2 | |
| gh_url = 'https://api.github.com' | |
| req = urllib2.Request(gh_url) | |
| password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |