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 | |
| # | |
| # 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 |
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 ( | |
| "log" | |
| "bufio" | |
| "time" | |
| "os" | |
| "fmt" | |
| "io" | |
| "net" |
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" | |
| "io/ioutil" | |
| "net" | |
| "os" | |
| "strings" |
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
| rs = [ | |
| (1, 0), | |
| (2, 1), | |
| (3, 1), | |
| (4, 2), | |
| (5, 4), | |
| ] | |
| class Node(object): |
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 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") |
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
| [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 |
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
| 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 |
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 "net" | |
| import "fmt" | |
| import "strconv" | |
| import "strings" | |
| func main() { | |
| b, _ := IPToUint("111.11.191.17") | |
| fmt.Println("111.11.191.17") |
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 "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")) | |
| } |