Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| # Share ppp0 to wlan0 | |
| ifconfig wlan0 down | |
| iptables --flush | |
| iptables --table nat --flush | |
| iptables --delete-chain | |
| iptables --table nat --delete-chain | |
| iwconfig wlan0 mode Ad-Hoc |
| from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer | |
| class ServerHandler(BaseHTTPRequestHandler): | |
| def do_GET(self): | |
| print "GET :",self.path | |
| # Send success response | |
| self.send_response(200) | |
| self.send_header('Content-type','text/html') | |
| self.end_headers() | |
| # Return Data |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| http://cdimage.debian.org/debian-cd/6.0.6/i386/iso-cd/debian-6.0.6-i386-netinst.iso | |
| http://mirror.ufs.ac.za/linuxmint//stable/14/linuxmint-14-cinnamon-dvd-64bit.iso | |
| http://cdimage.debian.org/debian-cd/6.0.6/amd64/iso-dvd/debian-6.0.6-amd64-DVD-1.iso |
| #!/usr/bin/env python | |
| # Author: Chris Eberle <eberle1080@gmail.com> | |
| # Watch for any changes in a module or package, and reload it automatically | |
| import pyinotify | |
| import imp | |
| import os | |
| class ModuleWatcher(pyinotify.ProcessEvent): | |
| """ |
| #!/bin/bash | |
| # author: jishnu7@gmail.com | |
| # Pre-commit hook passing files through jshint | |
| # Temperory staging area | |
| TMP_STAGING=".tmp_staging" | |
| # absolute path of this repo | |
| ROOT_DIR=$(git rev-parse --show-toplevel) | |
| # path of your jshint config | |
| CONF="--config=${ROOT_DIR}/tools/jshintrc" |
| javascript:( | |
| function() { | |
| var document = window.frames.mainFrame.document, | |
| fst = document.getElementById('fst').value, | |
| snd = document.getElementById('snd').value; | |
| document.getElementById('sum').value = parseInt(fst, 10) + parseInt(snd, 10); | |
| } | |
| )(); |
| { | |
| // screen | |
| map_screen: { | |
| // milestone number | |
| 1: [ | |
| { | |
| id: 'milestone', | |
| text: 'Welcome! Tap on Milestone-1 to start playing.' | |
| }, | |
| { |
| tutorial.build({ | |
| // parent view | |
| superview: this, | |
| // screen name - used to get tutorial from data | |
| type: "map_screen", | |
| // milestone number - to identify tutorial | |
| milestone: this._currentId, | |
| // timeout for tutorial to start. | |
| timeout: 1000, | |
| // disable events to this view and sub view when tutorial is visible/processing |