Skip to content

Instantly share code, notes, and snippets.

View tejainece's full-sized avatar

Ravi Teja Gudapati tejainece

View GitHub Profile
@tejainece
tejainece / mersenne_predict.py
Created May 7, 2020 14:51 — forked from Rhomboid/mersenne_predict.py
Predict output of Mersenne Twister after seeing 624 values
#!/usr/bin/env python
#
# Mersenne Twister predictor
#
# Feed this program the output of any 32-bit MT19937 Mersenne Twister and
# after seeing 624 values it will correctly predict the rest.
#
# The values may come from any point in the sequence -- the program does not
# need to see the first 624 values, just *any* 624 consecutive values. The
# seed used is also irrelevant, and it will work even if the generator was
@tejainece
tejainece / tmux-cheatsheet.markdown
Created November 16, 2019 16:40 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tejainece
tejainece / postgres-cheatsheet.md
Created June 2, 2019 14:39 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@tejainece
tejainece / postgres_cheat_sheet
Created June 1, 2019 20:42 — forked from johnnyjung/postgres_cheat_sheet
Postgres Cheat Sheet
Postgres Cheat Sheet
Source: Postgresql Documentation
### shell commands
creatuser <user>
deletesuer <user>
createdb -O <user> -E utf8 -T <template> <db_name>
dropdb <db_name>
@tejainece
tejainece / liblinear_vs_lightning.py
Created June 4, 2018 14:09 — forked from arthurmensch/liblinear_vs_lightning.py
SAGAClassifier vs sklearn liblinear
import numpy as np
from lightning.classification import SAGAClassifier
from scipy import sparse
from sklearn.datasets import load_iris, make_classification
from sklearn.linear_model.logistic import (
LogisticRegression,
)
@tejainece
tejainece / sqlite2csv.sh
Created March 19, 2018 13:15 — forked from carlosefonseca/sqlite2csv.sh
Exports all tables in a sqlite database to CSV.
#!/usr/bin/env bash
# obtains all data tables from database
TS=`sqlite3 $1 "SELECT tbl_name FROM sqlite_master WHERE type='table' and tbl_name not like 'sqlite_%';"`
# exports each table to csv
for T in $TS; do
sqlite3 $1 <<!
.headers on