Skip to content

Instantly share code, notes, and snippets.

View murarisumit's full-sized avatar
🎩
Welcome here

Sumit Murari murarisumit

🎩
Welcome here
View GitHub Profile
@murarisumit
murarisumit / Nginx grok format
Created September 16, 2016 06:44
NGinx grok format logstash.
# Nginx
NGUSERNAME [a-zA-Z\.\@\-\+_%]+
NGUSER %{NGUSERNAME}
NGINXACCESS %{IPORHOST:clientip} %{NGUSER:ident} %{NGUSER:auth} \[%{HTTPDATE:timestamp}\] "%{WORD:verb} %{URIPATHPARAM:request} HTTP/%{NUMBER:httpversion}" %{NUMBER:response} (?:%{NUMBER:bytes}|-) (?:"(?:%{URI:referrer}|-)"|%{QS:referrer}) %{QS:agent}
# Nginx error formats
NGINXERROR0 (?<timestamp>\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}) \[%{DATA:err_severity}\] (%{NUMBER:pid:int}#%{NUMBER}: \*%{NUMBER}|\*%{NUMBER}) %{DATA:err_message}(?:, client: (?<client_ip>%{IP}|%{HOSTNAME}))(?:, server: %{IPORHOST:server})(?:, request: %{QS:request})?(?:, host: %{QS:clientip})?(?:, referrer: \"%{URI:referrer})
NGINXERROR1 %{DATESTAMP:timestamp} \[%{DATA:err_severity}\] %{GREEDYDATA:err_message}
@murarisumit
murarisumit / vidle.sh
Last active November 8, 2017 07:23
Idle in vitualenv #python #idle
#!/bin/bash
#Opening idle in virtualenv
LOCAL_BIN_HOME="$HOME/.local/bin"
mkdir -p $LOCAL_BIN_HOME
echo "python -m idlelib.idle" > $LOCAL_BIN_HOME/vidle
chmod +x $LOCAL_BIN_HOME/vidle
#Add the local bin path to PATH
export PATH=$PATH:$LOCAL_BIN_HOME
#Execute $ vidle
@murarisumit
murarisumit / xml_json_vim
Created June 17, 2016 05:53
Preety print xml and json in vim #vim #json #pretty
Preety print xml and json in vim
XML:
1. Install xmllint : `sudo apt-get install libxml2-utils`
2. Use xmllint to format the xml
3. Add this to vimrc: `nmap =x :%!xmllint % --format<CR>`
JSON:
@murarisumit
murarisumit / stop_and_wait_till_stopped_state.sh
Created March 31, 2016 02:47
Stop instance and wait till it's in stopped state.
#!/bin/bash
profile=your_creds_profile
output=your_output_fomat['text' or 'json' ...]
instance_id=i-454645644744 #yourinstance_id here
cmd='aws ec2 describe-instances --instance-ids $instance_id --profile $profile'
aws ec2 stop-instances --instance-ids $instance_id --profile zeus
COUNTER=0
while [ $COUNTER -lt 60 ]; do
@murarisumit
murarisumit / rsync
Created January 26, 2016 05:03
Remote RSYNC example
rsync -a file -e 'ssh -i security_file -p 22' use@addr:file
@murarisumit
murarisumit / git-aliases.md
Created January 7, 2016 05:10 — forked from mwhite/git-aliases.md
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@murarisumit
murarisumit / gist:5a82f3c69e0a9d37239b
Last active July 15, 2016 13:25 — forked from apoo/gist:2279196
Managing multiple SSH Keys for different GitHub Accounts
Create separate SSH key for your personal account and your company.
Put these file in different location in your .ssh folder.
Upload them to your github account and finally create a **config file for your SSH**
Create a config file in ~/.ssh/config
vim config:
@murarisumit
murarisumit / gist:45fae1d1c21c1afa386e
Created October 21, 2015 12:30 — forked from PiBa-NL/gist:531373a49264aeb5dc3f
Haproxy stand alone stats listen section
listen MyStats
mode http
bind 0.0.0.0:1000
stats enable
stats uri /
# if authentication is wanted
acl auth_ok http_auth(stats-auth)
http-request auth unless auth_ok
@murarisumit
murarisumit / msdeploy_sync_skip_file.bat
Created September 16, 2015 06:25
Msdeploy ignore some file
::Skip file with name .pdb, someFile.xml and .config$
msdeploy.exe -verb:sync -source:contentPath=SourcePath -dest:DestPath -skip:objectName=filepath,absolutepath="^*\.pdb$" -skip:objectName=filepath,absolutepath="^*\someFile.xml$" -skip:objectName=filepath,absolutepath="^*\someotherfile.aspx$" -skip:objectName=filepath,absolutepath=".config$"
@murarisumit
murarisumit / perseverance.md
Created September 15, 2015 12:43
Patience, persistence and perseverance #murarisumit

Take your time to build something you will be proud of. Patience, persistence and perseverance will take you anywhere you want to go