start new:
tmux
start new with session name:
tmux new -s myname
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
Installation using distribute and pip | |
NOTE: If you don't want to touch system files or you don't have root, please see this question on stackoverflow. For everyone else please read on... | |
Install distribute and pip | |
According to the distribute website setuptools and easy_install are old and busted (the version included in Ubuntu 12.04 doesn't work with python3), and distribute and pip are the new hotness. So we will use those: | |
curl -O http://python-distribute.org/distribute_setup.py | |
sudo python distribute_setup.py | |
sudo easy_install pip |
exec ssh-agent /bin/bash |
from django.contrib import messages | |
messages.add_message(request, messages.INFO, 'Hello world.') | |
# Shortcut way to add messages | |
messages.debug(request, '%s SQL statements were executed.' % count) | |
messages.info(request, 'Three credits remain in your account.') | |
messages.success(request, 'Profile details updated.') | |
messages.warning(request, 'Your account expires in three days.') | |
messages.error(request, 'Document deleted.') |
import pdfcrowd | |
try: | |
# create an API client instance | |
client = pdfcrowd.Client("username", "apikey") | |
# convert a web page and store the generated PDF into a pdf variable | |
pdf = client.convertURI('http://www.google.com') | |
# convert an HTML string and save the result to a file |
import pdfcrowd | |
from django.http import HttpResponse | |
def generate_pdf_view(request): | |
try: | |
# create an API client instance | |
client = pdfcrowd.Client("username", "apikey") | |
# convert a web page and store the generated PDF to a variable | |
pdf = client.convertURI("http://www.google.com") |
wget --limit-rate=200k --no-clobber --convert-links -r -p -E -e robots=off -U mozilla http://django-notification.readthedocs.org/en/latest/ |
find . -maxdepth 1 -name '??????' -size 0 -delete |
#!/bin/bash | |
set -e | |
function init_ssl { | |
mkdir -p /etc/kubernetes/ssl | |
local TEMPLATE=/etc/kubernetes/ssl/ca.pem | |
[ -f $TEMPLATE ] || { | |
echo "TEMPLATE: $TEMPLATE" | |
mkdir -p $(dirname $TEMPLATE) | |
cat << EOF > $TEMPLATE |