start new:
tmux
start new with session name:
tmux new -s myname
| var http = require('http'); | |
| function fibonacci(n) { | |
| if (n < 2) | |
| return 1; | |
| else | |
| return fibonacci(n-2) + fibonacci(n-1); | |
| } | |
| http.createServer(function (req, res) { |
| import SocketServer | |
| import SimpleHTTPServer | |
| PORT = 1339 | |
| def fibonacci (n): | |
| if n < 2: | |
| return 1 | |
| else: | |
| return fibonacci(n - 2) + fibonacci(n - 1) |
| gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_background" --type bool false | |
| gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_colors" --type bool false | |
| gconftool-2 --set "/apps/gnome-terminal/profiles/Default/palette" --type string "#070736364242:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#EEEEE8E8D5D5:#00002B2B3636:#CBCB4B4B1616:#58586E6E7575:#65657B7B8383:#838394949696:#6C6C7171C4C4:#9393A1A1A1A1:#FDFDF6F6E3E3" | |
| gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" --type string "#00002B2B3636" | |
| gconftool-2 --set "/apps/gnome-terminal/profiles/Default/foreground_color" --type string "#65657B7B8383" |
| import requests | |
| import simplejson | |
| r = requests.get('https://github.com/timeline.json') | |
| c = r.content | |
| j = simplejson.loads(c) | |
| for item in j: | |
| print item['repository']['name'] |
| import requests | |
| import lxml | |
| from lxml import html | |
| r = requests.get('http://gun.io') | |
| tree = lxml.html.fromstring(r.content) | |
| elements = tree.get_element_by_id('frontsubtext') | |
| for el in elements: | |
| print el.text_content() |
| from django.shortcuts import render_to_response | |
| def home(request, input="No input supplied"): | |
| output = input.upper() | |
| return render_to_response('home.html', {'output': output}) |
| import os | |
| TEMPLATE_DIRS = ( | |
| os.path.join(os.path.dirname(__file__), 'templates'), | |
| ) |
| from django.conf.urls.defaults import patterns, include, url | |
| urlpatterns = patterns('', | |
| url(r'^(?P<input>[^/]+)$', 'UppercaseMaker.upper.views.home'), | |
| ) |
| from time import sleep | |
| from tornado.httpserver import HTTPServer | |
| from tornado.ioloop import IOLoop | |
| from tornado.web import Application, asynchronous, RequestHandler | |
| from multiprocessing.pool import ThreadPool | |
| _workers = ThreadPool(10) | |
| def run_background(func, callback, args=(), kwds={}): | |
| def _callback(result): |