Skip to content

Instantly share code, notes, and snippets.

View shafiul's full-sized avatar
💭
Research Scientist, Software Engineer

Shafiul Azam Chowdhury shafiul

💭
Research Scientist, Software Engineer
View GitHub Profile
@ssbarnea
ssbarnea / mysql-convert-utf8.py
Created July 6, 2011 18:48
Script to convert a a database to use utf8 encoding
#! /usr/bin/env python
import MySQLdb
host = "localhost"
passwd = ""
user = "root"
dbname = "mydbname"
db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=dbname)
cursor = db.cursor()
@cmaes
cmaes / find_elem_circuits.m
Created October 3, 2011 20:31
Find all the elementary circuits of a directed graph
function [numcycles,cycles] = find_elem_circuits(A)
if ~issparse(A)
A = sparse(A);
end
n = size(A,1);
Blist = cell(n,1);
@shafiul
shafiul / bn-chrome.user.js
Created March 2, 2012 03:43
Bangla Phonetic Typing Support for Browsers
// ==UserScript==
// @name Automatic Bangla Phonetic Typing Support
// @namespace http://bengali.sourceforge.net
// @description Automatically makes all Text input & text-area fields of Chrome browser Bangla phonetic compatible. use Ctrl + Y to switch between Bangla & English
// @include *
// @exclude http://www.somewhereinblog.net/*
// ==/UserScript==
// abp_version = "1.1";
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
# Simple database and session wrapper. I use it in my Flask app too.
class Database(object):
def __init__(self):
self.session_maker = sessionmaker()
self.session = scoped_session(self.session_maker)
self.engine = None
@dmitric
dmitric / backend.py
Created March 24, 2012 18:06
SqlAlchemy usage with tornado backend
class Backend(object):
def __init__(self):
engine = create_engine("mysql://{0}:{1}@{2}/{3}".format(options.mysql_user, options.mysql_pass, options.mysql_host, options.mysql_db)
, pool_size = options.mysql_poolsize
, pool_recycle = 3600
, echo=options.debug
, echo_pool=options.debug)
self._session = sessionmaker(bind=engine)
@classmethod
@redmoses
redmoses / Proxy-README.md
Last active February 28, 2016 13:33
SSH tunnelling using dynamic proxy

SSH Proxy Script by Red Moses

http://redmoses.me

This script connects to a SSH server to create a dynamic tunnel proxy. I'm assuming you use a private key for authenticating to the server.

Script configuration

To use this script you must first configure it according to your details. I have supplied some dummy values for the configuration fields to start with.

# SSH user