Skip to content

Instantly share code, notes, and snippets.

View ibrahim12's full-sized avatar

Ibrahim Rashid ibrahim12

View GitHub Profile
@ibrahim12
ibrahim12 / migrate.py
Created November 18, 2020 15:44 — forked from jmuhlich/migrate.py
Alembic migration to rename primary and foreign key constraints along with a table rename
from alembic import op
from alembic.operations.ops import CreatePrimaryKeyOp, CreateForeignKeyOp
import sqlalchemy as sa
def upgrade():
conn = op.get_bind()
ctx = op.get_context()
existing_metadata = sa.schema.MetaData()
target_metadata = ctx.opts['target_metadata']
@ibrahim12
ibrahim12 / delete_x_days_old_git_branches
Created April 30, 2020 23:00
delete_x_days_old_git_branches
for k in $(git branch | sed /\*/d); do
if [[ ! $(git log -1 --since='2 weeks ago' -s $k) ]]; then
git branch -D $k
fi
done
document.getElementsByClassName('modal_signup_dialog')[0].parentNode.parentNode.remove(); document.body.style.overflow = 'scroll';
```json
users = [
{
"_id" : 1000,
"fb_id" : "a",
"username" : "",
/* user other fields */
"posts" : [
{
@ibrahim12
ibrahim12 / setup.py
Created March 17, 2015 22:10
Python Package Sample Setup File
"""
Pacakge Name
-------------
Pacakge Description .
"""
from setuptools import setup
setup(
name='PACKAGE_NAME',
@ibrahim12
ibrahim12 / .pypirc
Created March 17, 2015 21:57
.pypirc sample
[distutils] # this tells distutils what package indexes you can push to
index-servers =
pypi
pypitest
[pypi]
repository: https://pypi.python.org/pypi
username: your_username
password: your_password
@ibrahim12
ibrahim12 / gist:9563312
Last active August 29, 2015 13:57
Nginx config
upstream project_name {
server unix:/web/nginx/sites/site-a.com/application/project_name/run/gunicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name projects.site-a.com;
client_max_body_size 4G;
@ibrahim12
ibrahim12 / gist:6278642
Created August 20, 2013 08:24
Git Commands
git rm --cached filename
git update-index --assume-unchanged [path]