Skip to content

Instantly share code, notes, and snippets.

from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
from itertools import izip, tee
def pairwise(iterable):
a, b = tee(iterable)
next(b, None)
return izip(a, b)
Sample:
>>>list(pairwise([1, 2, 3, 4,]))
def iter_except(func, exc_class, first=None):
try:
if first is not None:
yield first()
while 1:
yield func()
except exc_class:
pass
Samples:
from greenlet import greenlet
from functools import update_wrapper
def iter_from_func(f, args, kwargs):
p = greenlet.getcurrent()
g = greenlet(lambda: f(lambda x: p.switch((x,)), *args, **kwargs), p)
while 1:
rv = g.switch()
if rv is None:
return
yield rv[0]
import codecs
def _iter_encode(iterable, func):
for item in iterable:
encoded_item = func(item)
if encoded_item:
yield encoded_item
encoded_item = func('', True)
if encoded_item:
yield encoded_item
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Projects
source /usr/local/bin/virtualenvwrapper.sh
http://freetypography.com/
http://www.premiumpixels.com/
http://subtlepatterns.com/
http://designmodo.github.io/Flat-UI/
http://www.getuikit.com/docs/
http://codepen.io/hugo/pen/eoaDw
http://spyrestudios.com/20-free-open-source-css3-user-interface-kits/
http://speckyboy.com/2013/09/25/10-free-ui-kits/
http://purecss.io/
# To ensure default shell set properly to zsh. Type in Terminal.
chsh -s /bin/zsh
(or) chsh -s $(which zsh)
# attaching zsh to tmux(.tmux.conf)
set-option -g default-command "reattach-to-user-namespace -l zsh"
set-option -g default-shell /bin/zsh
# Set term color
1. Write in zshrc
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your apt-get is working properly and up to date
sudo apt-get upgrade
sudo apt-get update
## Install ###################################################################
@getadeo
getadeo / tmux.md
Created February 11, 2014 11:13 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a