Skip to content

Instantly share code, notes, and snippets.

View timusg's full-sized avatar
🎯
Focusing

sumit gupta timusg

🎯
Focusing
View GitHub Profile
@timusg
timusg / sock_state.sh
Last active December 17, 2015 02:49
print number of sockets in different tcp state
netstat -ant | awk '{print $6}' | sort | uniq -c
@timusg
timusg / redis-multi-delete.sh
Created May 11, 2013 16:45
redis , delete multiple keys matching regex pattern
redis-cli keys "*" | xargs -I {} redis-cli del "{}"
@timusg
timusg / g-key-pentadactyl.md
Last active December 17, 2015 06:09
power g key in pentadactyl

##Power of g in pentadactyl##

Pentadactyl is vim inspired interface to firefox and similar to vimperator.

like vim (:g) , g is a power key in pentadactyl

some examples:

command ...
@timusg
timusg / socket_io_heroku.js
Created May 20, 2013 09:31
configure socket.io for heroku , using xsr-polling instead of websockets
io.configure(function () {
io.set("transports", ["xhr-polling"]);
io.set("polling duration", 10);
});
@timusg
timusg / apache_rewrite_whitelisting.sh
Last active December 17, 2015 17:59
apache rewrite for restrict access to few white listed ip address and add extra params in query string
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^100\.212\.123\.XX$
RewriteCond %{REMOTE_ADDR} !^XX\.XX\.XXX\.XX$
RewriteRule ^/foo - [F]
RewriteRule ^/foo http://example.com/foo?bar=qux [P,QSA]
@timusg
timusg / mongo_delele_collections.js
Created August 28, 2013 04:00
delete collection by some query paarms
var collectionNames = db.getCollectionNames();
for(var i = 0, len = collectionNames.length; i < len ; i++){
var collectionName = collectionNames[i];
if(collectionName.indexOf('foo') == 0){
db[collectionName].drop()
}
}
@timusg
timusg / fast_file_count.sh
Created September 11, 2013 17:12
fast file count in large number of files in dir
time python -c "from os import listdir; print len(listdir('some dir'))"
@timusg
timusg / Dockerfile
Last active December 25, 2015 09:39 — forked from paulczar/Dockerfile
# Chef-Zero
#
# VERSION 0.0.1
FROM base
MAINTAINER Paul Czarkowski "username.taken@gmail.com"
RUN apt-get update
RUN apt-get install -y ruby1.9.1-dev build-essential
@timusg
timusg / chef-server.sh
Last active December 28, 2015 07:29
install chef server on ubuntu
wget https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef-server_11.0.8-1.ubuntu.12.04_amd64.deb
dpkg -i chef-server_11.0.8-1.ubuntu.12.04_amd64.deb
sudo chef-server-ctl reconfigure
@timusg
timusg / install-docker.sh
Last active December 28, 2015 07:29
install docker in ubuntu 12.04 x86
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
# Add the Docker repository to your apt sources list.
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
# Update your sources
sudo apt-get update
# Install, you will see another warning that the package cannot be authenticated. Confirm install.