Skip to content

Instantly share code, notes, and snippets.

View mapix's full-sized avatar

mapix mapix

View GitHub Profile
#!/bin/bash
#
# bash < <(curl -s https://gist.github.com/jmervine/5407622/raw/nginx_w_lua.bash)
# Adapted from http://mervine.net/nginx-with-lua-module
# REQUIREMENT - uncomment if PCRE library is not already installed
# apt-get install libpcre3 libpcre3-dev
set -x
@mapix
mapix / sshtunnel.go
Created March 1, 2016 08:38 — forked from iamralch/sshtunnel.go
SSH tunnelling in Golang
package main
import (
"log"
"bufio"
"time"
"os"
"fmt"
"io"
"net"
@mapix
mapix / ssh_client.go
Created March 1, 2016 08:31 — forked from iamralch/ssh_client.go
SSH client in GO
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strings"
rs = [
(1, 0),
(2, 1),
(3, 1),
(4, 2),
(5, 4),
]
class Node(object):
def checkRequiredArguments(opts, parser):
missing_options = []
for option in parser.option_list:
if re.match(r'^\[REQUIRED\]', option.help) and eval('opts.' + option.dest) == None:
missing_options.extend(option._long_opts)
if len(missing_options) > 0:
parser.error('Missing REQUIRED parameters: ' + str(missing_options))
parser = OptionParser()
parser.add_option("-s", "--start-date", help="[REQUIRED] Start date")
@mapix
mapix / .gitconfig
Last active August 29, 2015 14:15 — forked from mat/.gitconfig
[alias]
# bread and butter
st = status
s = status -sb
d = diff
dc = diff --cached
p = pull --rebase
ir = rebase -i origin/master
amend = commit --amend
l = log --pretty=format:'%Cred%h%Creset %C(bold blue)<%an> -%C(yellow)%d%Creset %s %Cgreen(%cr) %Creset' --abbrev-commit --date=relative
@mapix
mapix / INSTALL
Last active August 29, 2015 14:15 — forked from mat/INSTALL
TODO:
- edit /opt/statsd/local.js
- correct the graphite host to localhost
- if desired, put 'debug: true' in there
- make the box accessible via the hostname 'graphite'
- update conf/storage-schemas.conf, see example for these retention rules:
6 hours of 10 second data
1 week of 1 minute data
5 years of 10 minute data
package main
import "net"
import "fmt"
import "strconv"
import "strings"
func main() {
b, _ := IPToUint("111.11.191.17")
fmt.Println("111.11.191.17")
@mapix
mapix / IsPrivateIP.go
Created February 4, 2015 09:14
golang version of isPrivateIP
package main
import "net"
import "fmt"
func main() {
fmt.Println(IsPrivateIP("111.11.191.17"))
fmt.Println(IsPrivateIP("192.168.0.100"))
fmt.Println(IsPrivateIP("10.0.8.100"))
}