Skip to content

Instantly share code, notes, and snippets.

View jineshpaloor's full-sized avatar

Jinesh Panampattakunnath jineshpaloor

View GitHub Profile
@jineshpaloor
jineshpaloor / find_expensive_query.sql
Created March 4, 2014 13:35
query to find the queries which is taking long time to process.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST where COMMAND = "query" and Time > 1 order by time asc;SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST where COMMAND = "query" and Time > 1 order by time asc;
@jineshpaloor
jineshpaloor / daemon_process.py
Last active August 29, 2015 14:04
Daemon to checks whether 'status' of one model, if it is '0' then update another model, else if it is '1' then don't do anything.
#standard python libs
import logging
import time
#third party libs
from daemon import runner
from utils process_shipment_queue
@jineshpaloor
jineshpaloor / bashrc_scripts.sh
Created September 18, 2014 06:33
startup scripts for linux terminals
# setup for virtualenv wrapper
export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh
# cleanup command
alias cleanup='echo "Cleaning Up" && sudo apt-get -f install && sudo apt-get autoremove && sudo apt-get -y autoclean && sudo apt-get -y clean'
@jineshpaloor
jineshpaloor / performance_optimization.py
Created December 7, 2014 09:17
Performance tuning observations based on S. Anand techniques
# install ipython line_profiler
@jineshpaloor
jineshpaloor / downgrade.txt
Created December 19, 2014 11:37
how to downgrage django1.7 to 1.4
rm -r /usr/local/lib/python2.7/site-packages/django/
rm -r /usr/local/lib/python2.7/site-packages/Django-1.7.1-py2.7.egg-info/
install older version from source
@jineshpaloor
jineshpaloor / django test
Created January 14, 2015 05:51
django test
./manage.py test -v3 manifest.tests.views.ManifestViewsTestCase
@jineshpaloor
jineshpaloor / mysql.sql
Last active August 29, 2015 14:18
show
DESC INFORMATION_SCHEMA.PROCESSLIST;
select id, time, user, host, command from INFORMATION_SCHEMA.PROCESSLIST order by time desc;
@jineshpaloor
jineshpaloor / mongodb_install.bash
Last active August 29, 2015 14:18
mongodb installation script to install and run process as daemon
# Local
========
~ cd /mongo/installation/directory/
~ cd ~/opt/mongodb-linux-x86_64-ubuntu1404-3.0.1/
# Start Mongodb server
# ====================
- bin/mongod --config bin/mongodb.config
@jineshpaloor
jineshpaloor / port_watch
Last active August 29, 2015 14:20
checking open port on server
# I am trying from the server 54.85.216.40
# Index Server
# =========
root@ip-10-0-0-11:/home/ubuntu# telnet -d 54.169.89.119 27017
Trying 54.169.89.119...
telnet: Unable to connect to remote host: Connection timed out
@jineshpaloor
jineshpaloor / create_unique_string.py
Last active August 29, 2015 14:20
Python script to create a unique string corresponding to a given input number.
import string
# number_letter_map = {0: 'A', 1: 'B', ... , 51: 'z'}
number_letter_map = dict(zip(range(52), string.letters))
def get_unique_string(number):
"""
Take a number as input and return a unique string corresponding to that number.
"""