##Postgres commands cheatsheet
#####Setup data directory for database
initdb -D /usr/local/pgsql/data
#####Reload Postgres config from command line:
select pg_reload_conf();
##Postgres commands cheatsheet
#####Setup data directory for database
initdb -D /usr/local/pgsql/data
#####Reload Postgres config from command line:
select pg_reload_conf();
| import sqlalchemy | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy import Column, Integer, String, ForeignKey | |
| from sqlalchemy.orm import sessionmaker, relationship | |
| engine = sqlalchemy.create_engine('sqlite:///:memory:') | |
| Base = declarative_base() |
| import sqlalchemy | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy import Column, Integer, String | |
| from sqlalchemy.orm import sessionmaker, relationship, backref | |
| import uuid | |
| import json | |
| engine = sqlalchemy.create_engine('sqlite:///:memory:', echo=True) | |
| Base = declarative_base() |
| [kiran@Kirans-MacBook-Pro:~] | |
| % python -m timeit 'x = 1 << 100000' | |
| 10000000 loops, best of 3: 0.0278 usec per loop | |
| [kiran@Kirans-MacBook-Pro:~] | |
| % python -m timeit 'x = pow(2,100000)' | |
| 1000 loops, best of 3: 334 usec per loop |
.......
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| ############################################################ | |
| # # | |
| # Simple script to connect to a remote mysql database # | |
| # # | |
| # # | |
| # Install MySQLdb package by running: # | |
| # # |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| ################################################ | |
| # # | |
| # Script to download entire animorphs series # | |
| # # | |
| # Usage: python animorphs-downloader.py --help # | |
| # # | |
| ################################################# |
git checkout fix
git reset HEAD^
git checkout -b fix-1
git add -p
git commit
git stash
git checkout -b fix-1
git stash pop
git commit -a