Skip to content

Instantly share code, notes, and snippets.

@shilpavijay
shilpavijay / sqlite3
Created March 5, 2016 12:49
Sqlite 3 useful
.open <dbname>.db
sqlite3 <dbname>.db < <file>.sql
@shilpavijay
shilpavijay / virtual env.txt
Last active March 12, 2016 04:08
Setting up virtual env
sudo apt-get install python-pip
pip install virtualenv
cd projects
virtualenv venv
source venv/bin/activate
pip install Flask
pip install virtualenvwrapper
vim .bashrc
Add below two lines to .bashrc:
export WORKON_HOME=~/Envs/
python -m SimpleHTTPServer
@shilpavijay
shilpavijay / mezzanine and Cartridge
Last active December 28, 2016 11:40
Mezzanine/Cartridge
Packages needed:
1. mezzanine (CMS)
2. south (for DB migrations)
3. django-compressor (for dealing static files)
4. cartridge (for shopping cart)
Creating a new project:
- delete manage.py and folders (everything except readme.md) from the django project
- $ mezzanine-project -a cartridge <project_name>
@shilpavijay
shilpavijay / Cassandra
Last active May 18, 2017 05:59
Cassandra
CREATE KEYSPACE "test" WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};EXIT
use test;
describe tables;
To exit cqlsh: EXIT
CASSANDRA QUERY PARSER:
-------------------------
1. Download https://github.com/Stratio/cassandra-lucene-index
Ensure lucene-index version and Cassandra versions are the same.
npm install -g vue-cli --first time installation of npm vue-cli
Create new project:
vue init webpack-simple <vueprojname> --creates a new vue project with the template as webpack-simple
? (vueprojname) --confirm project name and other details.
npm install
npm run dev
@shilpavijay
shilpavijay / flask
Last active January 18, 2018 11:17
Flask/ SQLAlchemy/ flask-angular
$ export FLASK_APP=hello.py --linux
$ set FLASK_APP=hello.py --windows CMD
$ python -m flask run
var h = 500;
var w = 800;
var svg = d3.select("body").append("svg")
.attr("id","chart")
.attr("width",w)
.attr("height",h);
var num = 51;
var types = 4;
SSH:
ssh-keygen -t rsa
enter passphrase.
copy content of .ssh/id_rsa.pub:
clip < ~/.ssh/id_rsa.pub
creating user:
adduser shilpa
gpasswd -a shilpa root
gpasswd -a shilpa sudo
@shilpavijay
shilpavijay / frozen flask for MDW
Last active February 7, 2018 04:22
Frozen flask
to install:
Frozen-Flask
to run:
python <pyfilename> build
import sys
from flask import Flask
from flask import render_template
import pandas as pd