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 |
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 | |
# 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
// 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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net" | |
"regexp" | |
"strconv" | |
) |
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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"sync" |
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
// Crear un programa que declare dos funciones anónimas. Una que cuente del 0 al 200 y otra que cuente de 200 a 0. | |
// Mostrar cada número con un identificador único para cada goroutine. | |
// Crear goroutines a partir de estas funciones. | |
// No permitir que main regrese hasta que ambas goroutines hayan terminado de correr. | |
// https://play.golang.org/p/wjhbcgFg-g | |
package main | |
// Agregar imports. |
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
# Based on http://fearby.com/article/update-openssl-on-a-digital-ocean-vm/ | |
$ sudo apt-get update | |
$ sudo apt-get dist-upgrade | |
$ wget ftp://ftp.openssl.org/source/openssl-1.0.2j.tar.gz # Check the last version | |
$ tar -xvzf openssl-1.0.2h.tar.gz | |
$ cd openssl-1.0.2h | |
$ ./config --prefix=/usr/ | |
$ make depend |
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
package main | |
import ( | |
"context" | |
"fmt" | |
"os" | |
"os/signal" | |
"sync" | |
"syscall" | |
"time" |
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
package main | |
import ( | |
"encoding/xml" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"os" | |
"strings" |
OlderNewer