Skip to content

Instantly share code, notes, and snippets.

@avisri
avisri / elastic-reindex.py
Last active May 15, 2017 05:53
Reindex for elastic2.2 and older
from elasticsearch import Elasticsearch
from elasticsearch import helpers
es = Elasticsearch(["https://host"])
#not advised to run without proper ssl auth
import urllib3
urllib3.disable_warnings()
indexes=es.indices.get("*")
# change old and new string to match your usecase
@avisri
avisri / make-vim-project
Created October 1, 2016 10:22 — forked from cytopia/make-vim-project
Vim workflow for project and ctag files
#------------------------------------------------------
#-------- CTAGS
make-ctags() {
ctags -RBF -f .tags \
--file-scope=yes \
--sort=yes \
--extra=+fq \
2>/dev/null
}
make-ctags-css() {
#!/bin/bash
nPid=${1-`pgrep -f ossec-remoted`}
nTimes=${2:-100}
delay=${3:-0.1}
strCalc=`top -d $delay -b -n $nTimes -p $nPid \
|grep $nPid \
|sed -r -e "s;\s\s*; ;g" -e "s;^ *;;" \
|cut -d' ' -f9 \
|tr '\n' '+' \
|sed -r -e "s;(.*)[+]$;\1;" -e "s/.*/scale=2;(&)\/$nTimes/"`;
multiuser on
bindkey "^[[C" next
bindkey "^[[D" prev
defscrollback 1024
# other bindings
#bindkey -k F1 select 0 ## F11 = screen 0... avoid this screen :/
bindkey -k k1 select 1 ## F1 = screen 1
@avisri
avisri / _service.md
Last active December 5, 2015 11:29 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@avisri
avisri / install_vagrant_chef_elasticsearch.sh
Last active August 29, 2015 14:24
Vagrant ( chef/centos6.6) , chef(chefdk 0.6.2 , berkshelf ) , elastic search ( latest)
#!/bin/bash
mkdir vagrant-chef-elasticsearch
cd vagrant-chef-elasticsearch
time sh <<EOS
vagrant init chef/centos-6.6; vagrant up --provider virtualbox
vagrant ssh -c sh <<EOV
#install chefdk, build essentials, utilities
curl -# -L -k -o /tmp/cookbook-elasticsearch-master.tar.gz https://github.com/elasticsearch/cookbook-elasticsearch/archive/master.tar.gz
sh <<END
@avisri
avisri / brew_perl
Created April 27, 2015 18:27
Install perl and link using brew
brew install perl
brew link perl --force
@avisri
avisri / vagrant_box_add_latest_centos.sh
Last active August 29, 2015 14:19
Add latest Vagrant centos box from vagrantcloud/vStone
#!/bin/bash
LYNX=`which lynx || which yum|| which brew`
PKGMGR=`which yum|| which brew`
#if yum trigger all commands as sudo
[ "$PKGMGR%%yum" != "$PKGMGR" ] && PKGMGR="sudo $PKGMGR"
# install vagrant and virtualbox
$PKGMGR install vagrant virtualbox
@avisri
avisri / New_mac.sh
Created April 10, 2015 05:58
For new mac's
#!/bin/bash
#Simple Mac gist to get you some widely used dev( ruby ) tools .
#Requirements :
#bash, sudo access
#run this command sh -x <( this_file_raw_link ) 2>&1 | tee /tmp/install.log
#Optional
#index files
#sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
sys_rb_usr=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sdk_rb_usr=`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sudo cp -r $sdk_rb_usr/include $sys_rb_usr/include
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
#prompted the license agreement which needed to be accepted .
#Fix for error:
#============================