$yesterday = date('Y-m-d', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y")))
UPD: (thanks to stamm)
$yesterday = date('Y-m-d', strtotime('- 1 day'));
$yesterday = date('Y-m-d', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y")))
$yesterday = date('Y-m-d', strtotime('- 1 day'));
import sys
print "Version: %d.%d.%d\n" % sys.version_info[:3]
string_params = {'a':1, 'b': 2}
unicode_params = {u'a':1, u'b': 2}
def f(a,b):
print "params: ", a, b
print "Run with string params:"
f(**string_params)
print "\nRun with unicode params:"
f(**unicode_params)
Version: 2.5.1 Run with string params: params: 1 2 Run with unicode params: Traceback (most recent call last): Line 15, inf(**unicode_params) TypeError: f() keywords must be strings
network.http.use-cachebrowser.cache.offline.enablebrowser.cache.disk.enable
browser.cache.disk_cache_ssl
browser.cache.memory.enable>>> import cgi >>> >>> test_string = "This is <unsafe> string & it contains wrong symbols" >>> >>> print cgi.escape(test_string) This is <unsafe> string & it contains wrong symbols
sudo pip install werkzeugI made a runner script run.py that makes a dev server with Werkzeug and voila:
from werkzeug.serving import run_simple
from wsgi import application
run_simple('127.0.0.1', 4000, application)
sudo useradd -M -N username # (do not create hoMe dir; do not add to group "userName") sudo passwd username # enter password 'username'
psql -h 127.0.0.1 -p 5432 -U username -W -d template1 # insert your hostname and port if differentIn psql:
CREATE USER username WITH PASSWORD 'username'; ALTER USER username CREATEDB; -- allow user to create databases
<package-name>[==<version>] -e <repository address>#egg=<desirable-package-name>
# init or activate a virtual environment (virtual-env)$ pip install -r REQUIREMENTS
sudo easy_install pip virtualenv
sudo pip install virtualenvwrapper
mkdir ~/projects/.envs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python export WORKON_HOME=~/projects/.envs export PROJECT_HOME=~/projects source /usr/local/bin/virtualenvwrapper.sh
source ~/.bashrc
mkvirtualenv test workon testNow you're in the 'test' environment. To install new packages you can use, for instance, pip.
iwlist wlan0 scan | sed -n 's/.* Address: //p;T;s/ //g;q' | sed 's/.*/{version:1.1.0,host:maps.google.com,request_address:true,address_language:'${LANG/.*/}',wifi_towers:[{mac_address:"&",signal_strength:8,age:0}]}/' | curl -sX POST -d @- www.google.com/loc/json | sed -e 'h;s/.*latitude":\([^,]*\).*/\1/;G;s/\n[^\n]*longitude":\([^,]*\).*/,\1\n/;s|^|http://maps.google.com/maps?q=|;x;s/[,{]/\n/g;s/["}]//g;s/:/\t/g;s/\n//;G'
git diff --no-prefix > filename
patch -p0 < filename
patch -p1 < filename