This file contains hidden or 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
# expects single url parameter, returns url following redirects | |
resolve_url() { | |
curl -w "%{url_effective}\n" -I -L -s -S $1 -o /dev/null | |
} |
This file contains hidden or 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
# downloads a file specified by first parameter, puts it to /usr/local/bin (or second parameter) and gives it +x permissions | |
curl_install() { | |
if [[ $# == 0 ]]; then | |
echo "At least one parameter (url) is required" | |
return | |
elif [[ $# == 1 ]]; then | |
local url=$1 | |
local file="/usr/local/bin/"${url##*/} | |
elif [[ $# == 2 ]] ; then | |
local url=$1 |
This file contains hidden or 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
## gitr - returns verbose output for remotes | |
## gitr joe - adds remote joe as a fork of this repo | |
## gitr -joe - removes remote joe | |
gitr() { | |
if [[ $# == 1 ]]; then | |
local name=$1 | |
if [[ $name == -* ]]; then # starts with -, e.g. "-joe" | |
name=${name:1}; | |
echo "removing remote $name"; |
This file contains hidden or 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
alias intellij-memory="find ~/apps -iname '*.vmoptions' | xargs sed -i 's/-Xms.*$/-Xms2g/g;s/-Xmx.*$/-Xmx4g/g'" |
This file contains hidden or 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
psgrep() { ps aux | grep -v "grep" | egrep "%CPU"\|$1; } |
This file contains hidden or 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
STATSD_HOST="${STATSD_HOST:-localhost}" | |
STATSD_PORT="${STATSD_PORT:-8125}" | |
STATSD_PREFIX="${STATSD_PREFIX:-"docker"}" | |
INTERVAL="${STATS_COLLECT_INTERVAL:-2}" | |
while sleep "$INTERVAL"; do | |
docker stats --no-stream $(docker ps | awk '{if(NR>1) print $NF}') | tail -n+2 | while read line; | |
do | |
echo "line: " $line; | |
echo $line | awk '{printf("'${STATSD_PREFIX}'.%s.cpu:%.2f|c", $1, substr($2, 1, length($2)-1))}' | xargs echo | nc -v -u -w 0 $STATSD_HOST $STATSD_PORT; |
This file contains hidden or 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
echo "sample.count:10|c" | nc -v -u -w 0 localhost 8125 |
This file contains hidden or 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
docker images | grep \<none\> | awk '{print $3}' | xargs docker rmi |
This file contains hidden or 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
## test is the program that returns response body | |
while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; sh test; } | nc -l 8909; done | |
## test sample | |
#!/bin/bash | |
echo "************PRINT SOME TEXT***************\n" | |
echo "Hello World!!!" | |
echo "\n" |
This file contains hidden or 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
while true; do nc -ulw 0 8125; echo; done |