This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# written by sangdn 6/6/2016 | |
# to reduce stupid-time when up-to-date dependency projects | |
# config: | |
# set sbt_exclude/mvn_exclude to exclude build mode | |
# set mvn = PATH[param], PaTH[param] | |
# set mvn_options = option to build with maven command | |
# eg: | |
# sbt_exclude=clean | |
# sbt=PATH[clean,compile,publishLocal] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#search text in file in directory | |
grep -Ril "text-to-find-here" / | |
find . -name "*.txt" | xargs grep -i "text_pattern" | |
find . -name '*.py' -exec grep -n "text_pattern" {} \; -print | |
#understand xargs: find . -name "*.py" | xargs -n 1 echo | |
#sed | |
sed -i 's/test/test/g' file1.a | |
#awk: | |
http://code.linuxnix.com/2013/04/awk-scripting-learn-awk-built-in-variables-with-examples.html | |
awk -F’,’ ‘{print $4}’ db.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#save in ReadOnly mode | |
:w !sudo sh -c "cat > %" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create getswap.sh | |
#!/bin/bash | |
# Get current swap usage for all running processes | |
# Erik Ljungstrom 27/05/2011 | |
SUM=0 | |
OVERALL=0 | |
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do | |
PID=`echo $DIR | cut -d / -f 3` | |
PROGNAME=`ps -p $PID -o comm --no-headers` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /sys/block/sdb/queue/rotational | |
0: SSD, 1: HDD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# some common and useful google search tips | |
# for ref: http://www.google.com/advanced_search | |
###### tips ##### | |
define hello >> to looking for definition of hello | |
###### Content Search & Operator ######## | |
"hello world" >> to search for exact match of hello world | |
hello + world >> to search for hello and word eg: hello to my world | |
hello -world >> to search for hello, exclude word eg: hello to my house | |
hello * world >> to search fuzzy for hello *** world | |
~hello >> to search similar for hello eg: hi, hey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -printf "%T@ %Tc %p\n" | sort -n | |
printf arguments from man find: | |
%Tk: File's last modification time in the format specified by k. | |
@: seconds since Jan. 1, 1970, 00:00 GMT, with fractional part. | |
c: locale's date and time (Sat Nov 04 12:02:33 EST 1989). | |
%p: File's name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#node info | |
http://10.30.58.160:9210/_nodes/process?pretty | |
#disable for bulk indexing | |
curl -XPUT 'localhost:9210/_settings' -d ' | |
{ | |
"index" : { | |
"refresh_interval" : "60s" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this gist is used to answer for question from http://stackoverflow.com/questions/30691082/elasticsearch-either-or-match-query | |
#any question could request to zkidkid@gmail.com | |
# delete exist index | |
curl -XDELETE 'http://localhost:9200/furnit/' | |
#create new index | |
curl -XPUT 'http://localhost:9200/furnit/' | |
# create a new type which specify mappings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######################################################################################### | |
# Bash script for Subversion integration with Slack # | |
# # | |
# 1. Save this file in /usr/bin as incomming_webhook_slack # | |
# 2. Make it executable: # | |
# chmod +x /usr/bin/incomming_webhook_slack # | |
# 3. Put this line at the end of file of your_svn_repo/hooks/post-commit: # | |
# incomming_webhook_slack $REPOS $REV svn_path # | |
# 4. Edit this file, config all variable to point to your webhook # |