Skip to content

Instantly share code, notes, and snippets.

@adige
adige / grep recursive
Created April 12, 2016 19:46
greps recursive files with given string, "l" means prints only file names
grep -rl "string" /path
@adige
adige / pip_install_one_by_one
Created January 27, 2016 13:12
runs pip install for each line in requirement.txt
xargs -a requirements.txt -n 1 pip install
@adige
adige / print_all_users
Created January 27, 2016 07:41
list all users names
awk -F':' '{ print $1}' /etc/passwd
@adige
adige / check_open_ports
Created January 13, 2016 08:35
Check open ports without netstat or lsof
declare -a array=($(tail -n +2 /proc/net/tcp | cut -d":" -f"3"|cut -d" " -f"1")) && for port in ${array[@]}; do echo $((0x$port)); done
SOUTH_MIGRATION_MODULES = {
'tagging': 'ignore',
'tenant': 'ignore',
}
@adige
adige / delete_redis_keys
Created December 11, 2015 11:55
deletes keys in redis which starts "celery"
redis-cli keys "celery*" |awk '{print "redis-cli -c DEL " $1}' | sh
@adige
adige / delete_pyc
Created December 11, 2015 11:51
delete *.pyc files
find . -name "*.pyc" -exec rm -rf {} \;
@adige
adige / check_indexes.py
Created December 11, 2015 11:50
checks django created indexes and compare with postgres, list differences
from django.core.management.color import color_style, no_style
from django.core.management.base import BaseCommand
from django.conf import settings
from django.db.models.loading import get_apps
from django.db import connection
from django.core.management.sql import sql_indexes
import re
from optparse import make_option