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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#!/bin/bash | |
# Shows number of break attempts per user. | |
# threshold($1): Min number of break attempts. | |
sba() { | |
local threshold=${1:-10} | |
grep -Ei "(invalid|failed)" /var/log/auth.log | \ | |
sed -ne 's/.*sshd\[\([0-9]\+\)\].*for \(invalid user\)\? \(.*\) from \([0-9]\+\.[0-9]\+.[0-9]\+\.[0-9]\+\).*/sshd \1 \3 \4/p' | \ | |
awk -v limit=$threshold 'BEGIN {printf "USER\t ATTEMPTS\n"} {attempts[$3]++}END{ for (key in attempts)if (attempts[key] >= limit) printf "%-12s%d\n",key,attempts[key] }' | sort -n -k2 | |
} |
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
#!/bin/bash | |
LSB="/etc/lsb-release" | |
RELEASE=$(test -e $LSB && sed -ne 's/DISTRIB_CODENAME=\(.*\)/\1/gp' $LSB) | |
TMP='/tmp/puppet' | |
[[ -n "$RELEASE" ]] && (test -d $TMP-$RELEASE || mkdir -p $TMP-$RELEASE) || (echo "This is not an Ubuntu system based" && exit 1 ) | |
download() { |
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
#!/bin/bash | |
# Installing | |
printf "Installing rbenv....\n" | |
PLUGINS="${HOME}/.rbenv/plugins" | |
cd $HOME && [[ ! -d .rbenv ]] && git clone git://github.com/sstephenson/rbenv.git .rbenv | |
[[ ! -d $PLUGINS ]] && mkdir ${PLUGINS} && cd $PLUGINS && git clone git://github.com/sstephenson/ruby-build.git | |
# Configuring | |
printf "Updating %s\n" $HOME/.bashrc |
NewerOlder