Skip to content

Instantly share code, notes, and snippets.

View anshumanv's full-sized avatar
🌊
水の呼吸十一の型

Anshuman Verma anshumanv

🌊
水の呼吸十一の型
View GitHub Profile
npm install -g electron --unsafe-perm=true --allow-root
@anshumanv
anshumanv / db_create.py
Created November 26, 2017 13:20
Generic python script to init a SQLAlchemy Database in Flask
#!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
@anshumanv
anshumanv / db_migrate.py
Last active November 26, 2017 13:27
Python script to make SQLAlchemy DB migrations in a flask app
#!flask/bin/python
import imp
from migrate.versioning import api
from app import db
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
migration = SQLALCHEMY_MIGRATE_REPO + ('/versions/%03d_migration.py' % (v+1))
tmp_module = imp.new_module('old_model')
old_model = api.create_model(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
#!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
api.downgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, v - 1)
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
print('Current database version: ' + str(v))
const timeTaken = (func,...args) => {
var t0 = performance.now(), r = func(...args);
console.log(performance.now() - t0);
return r;
}
// timeTaken(Math.pow, 2, 10) -> 1024 (0.010000000009313226 logged in console)
@anshumanv
anshumanv / Codeheat 2017-18 work_product.md
Last active January 31, 2018 09:55
FOSSASIA Codeheat 2017-18 - anshumanv - Work Product
@anshumanv
anshumanv / npm-i-without-publish.sh
Created February 22, 2018 04:21
Install npm modules without publishing
npm install git+ssh://git@github.com/your-company/react-scripts-fork
@anshumanv
anshumanv / afcc.md
Last active February 24, 2018 04:05
Awesome fiddles, codepens, c9s
@anshumanv
anshumanv / raspi_commands.txt
Last active July 17, 2018 19:12
raspi commands
Find ip - cat /var/lib/misc/dnsmasq.leases
@anshumanv
anshumanv / GSoC 18 - anshumanv.md
Last active August 11, 2018 14:46
GSoC 18 Work Product - anshumanv