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 -l 8080 < index.html ; done |
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
| for i in {10..254}; do nc -v -n -z -w 1 192.168.36.$i 8000; done |
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
| # simple bash script that unstalls a version of rails (this could break if you have other gems matching the exact version name) | |
| # here we remove rails 4.0.0.rc1 | |
| # v1, simple | |
| #gem list | grep 4.0.0.rc1 | awk -F= 'BEGIN {FS = " "} ; {print $1}' | while read x ; do gem uninstall $x -v 4.0.0.rc1 ; done | |
| # v2, even shorter, no need for awk | |
| gem list | grep 4.0.0.rc1 | while read name _; do gem uninstall $name -v 4.0.0.rc1 ; done |
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
| require 'openssl' | |
| require 'base64' | |
| # Generate with this: OpenSSL::Cipher::Cipher.new("des-ede-cbc").tap{|c| c.encrypt}.random_key | |
| key = "\xBEB\xBA;\xA5\xEA-\x1A4\x0E8\xAC\x13\xF1s9\xB2\x87\xD3D\x9A\xC2\xA8\xC7" | |
| def encrypt(message, key) | |
| des_cbc=OpenSSL::Cipher::Cipher.new("des-ede-cbc") | |
| des_cbc.encrypt |
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
| def parse_phone(string) | |
| (Phoner::Phone.parse(string) || Phoner::Phone.parse('+' + string) rescue 'failed') | |
| end | |
| def verify_phones | |
| CSV.generate do |csv| | |
| Trip.all.each do |t| | |
| csv << [t.mobile, parse_phone(t.mobile)] | |
| end | |
| end |
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/sh | |
| DIR="$(basename $(PWD))" | |
| DIR="${DIR/-/_}" | |
| if [ "$1" == "execute" ] | |
| then | |
| if [ ! -f 'dump.db' ] | |
| then | |
| echo "downloading backup" | |
| curl `heroku pgbackups:url` > dump.db |
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
| find . -type f -name "*.go" -exec chmod a-x {} + |
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" | |
| "log" | |
| "net/http" | |
| "os" | |
| ) | |
| func handler(w http.ResponseWriter, r *http.Request) { |
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" | |
| "net/http" | |
| "os" | |
| "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
| require 'rubygems' | |
| require './post' | |
| run Sinatra::Application |