start new:
tmux
start new with session name:
tmux new -s myname
| """ | |
| Taken from (http://djangosnippets.org/snippets/1949/) | |
| and made some adjustments for cases when queryset is empty | |
| """ | |
| import gc | |
| def queryset_iterator(queryset, chunksize=1000): | |
| ''''' | |
| Iterate over a Django Queryset ordered by the primary key | 
| #!/bin/sh | |
| ### | |
| # SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
| # For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
| ### | |
| # Alot of these configs have been taken from the various places | |
| # on the web, most from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx | 
| #!/usr/bin/env python | |
| """Simple HTTP Server With Upload. | |
| This module builds on BaseHTTPServer by implementing the standard GET | |
| and HEAD requests in a fairly straightforward manner. | |
| """ | 
| requests==2.4.3 | |
| rsa==3.1.4 | 
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' | 
| #!/bin/bash | |
| # install squid | |
| apt-get install squid3 | |
| # Backup settingan default | |
| mv /etc/squid3/squid.conf /etc/squid3/squid.conf.bak | |
| # Tulis config baru | |
| cat > /etc/squid3/squid.conf <<END | 
| import json | |
| import os | |
| import time | |
| import requests | |
| from PIL import Image | |
| from StringIO import StringIO | |
| from requests.exceptions import ConnectionError | |
| def go(query, path): | |
| """Download full size images from Google image search. |