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
package main | |
import ( | |
"github.com/pkg/errors" | |
"github.com/ttacon/libphonenumber" | |
) | |
var ( | |
InvalidPhoneNumber = errors.New("phone number is invalid") | |
) |
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 | |
GITBRANCH=$(git branch | grep "\*" | awk '{print $2}') | |
PREFIX="XC" | |
if [ -z "${PROJECT_DIR}" ]; then | |
PROJECT_DIR=$(pwd) | |
fi | |
GIT_BRANCH=$(git branch | grep "\*" | awk '{print $2}') |
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
package main | |
import ( | |
"crypto/tls" | |
"io" | |
"log" | |
"net/http" | |
"os" | |
) |
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
magnet-info() { | |
hash=$(echo "${1,,}" | grep -oP "(?<=btih:).*?(?=&)") | |
echo "Magnet hash: $hash" | |
aria2c --bt-metadata-only=true --bt-save-metadata=true -q "$1" | |
aria2c "$hash.torrent" -S | |
rm "$hash.torrent" | |
} |
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
socat TCP-LISTEN:80,fork TCP:202.54.1.5:80 | |
socat -d -d -lmlocal2 \ | |
TCP4-LISTEN:80,bind=myaddr1,su=nobody,fork,range=10.0.0.0/8,reuseaddr \ | |
TCP4:www.nixcraft.net.in:80,bind=myaddr2 |
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
import logging | |
import flask | |
app = flask.Flask(__name__) | |
@app.before_first_request | |
def setup_logging(): | |
if not app.debug: | |
# In production mode, add log handler to sys.stderr. | |
app.logger.addHandler(logging.StreamHandler()) |
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
from signal import signal, SIGPIPE, SIG_DFL | |
#Ignore SIG_PIPE and don't throw exceptions on it... (http://docs.python.org/library/signal.html) | |
signal(SIGPIPE,SIG_DFL) |