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 | |
CURL=/usr/bin/curl | |
IFTTT_EVENT="<your event name>" | |
IFTTT_KEY="<your ifttt key>" | |
IFTTT_URL="https://maker.ifttt.com/trigger/${IFTTT_EVENT}/with/key/${IFTTT_KEY}" | |
PROCESS_NAME=`cat /proc/$1/cmdline` | |
send_notification(){ | |
${CURL} -X POST \ | |
${IFTTT_URL} \ |
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
$ curl -XGET http://localhost:9200/_cat/indices?v | |
health status index pri rep docs.count docs.deleted store.size pri.store.size | |
yellow open tarr-1970.01.01 5 1 109 0 132.9kb 132.9kb | |
yellow open tarr-2015.08.05 5 1 31976 0 4.4mb 4.4mb | |
yellow open ssltest-2015.07.31 5 1 5 0 22.1kb 22.1kb | |
yellow open tarr-2015.08.19 5 1 30228 0 3.8mb 3.8mb | |
yellow open tarr-2015.08.14 5 1 30225 0 3.8mb 3.8mb | |
yellow open tarr-2015.08.06 5 1 30849 0 4.1mb 4.1mb | |
yellow open tarr-2015.08.18 5 1 35344 0 5.5mb 5.5mb | |
yellow open tarr-2015.08.10 5 1 30223 0 3.9mb 3.9mb |
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 | |
CHECK_SUCCESS=0 | |
confirm_mkdir() | |
{ | |
while read -p "Do you mkdir? [y/n] " ANS ; do | |
case $ANS in | |
[Yy]* ) | |
echo "mkdir -p ${CHECKED_DIRS[$n]}" |
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
vi /etc/elasticsearch/elasticsearch.yml |
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
$ curl localhost:9200 | |
{ | |
"status" : 200, | |
"name" : "Wilson Fisk", | |
"version" : { | |
"number" : "1.1.1", | |
"build_hash" : "f1585f096d3f3985e73456debdc1a0745f512bbc", | |
"build_timestamp" : "2014-04-16T14:27:12Z", | |
"build_snapshot" : false, | |
"lucene_version" : "4.7" |
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/sh | |
HANDLER_DIR="/path/to/scripts" | |
if [ "$SERF_EVENT" = "user" ]; then | |
EVENT="tarr-$SERF_USER_EVENT" | |
elif [ "$SERF_EVENT" = "query" ]; then | |
case ${SERF_QUERY_NAME} in | |
"uptime") | |
uptime;; | |
* ) | |
EVENT="tarr-$SERF_QUERY_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
config.vm.define :drive do |drive| | |
drive.vm.box = "drive" | |
drive.vm.network :private_network, ip: "192.168.131.131" | |
end |
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
- module(primenum). | |
- export([primenum/1, printnum/2]). | |
primenum(Num) when Num >= 2 -> | |
primecheck(2, Num); | |
primenum(_Others) -> | |
false. | |
primecheck(TargetNum, TargetNum) -> | |
true; |
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
- module(primenum). | |
- export([primenum/1]). | |
primenum(Num) when Num > 2 -> | |
primecheck(2, Num); | |
primenum(Num) -> | |
io:format("Input integer over 2~n"). | |
primecheck(TargetNum, TargetNum) -> |
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
- module(fizzbuzz). | |
- export([check/1, fizzbuzz/1, loop/2]). | |
check(Num) when Num rem 15 =:= 0 -> | |
io:format("FizzBuzzz~n"); | |
check(Num) when Num rem 3 =:= 0 -> | |
io:format("Fizz~n"); | |
check(Num) when Num rem 5 =:= 0 -> | |
io:format("Buzz~n"); | |
check(Num) -> |
NewerOlder