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
_ "net/http/pprof" | |
go func() { | |
for _ = range time.Tick(time.Duration(10) * time.Second) { | |
fmt.Printf("Number of goroutines: %d\n", runtime.NumGoroutine()) | |
var m runtime.MemStats | |
runtime.ReadMemStats(&m) | |
fmt.Printf("heap in use: %v\n", m.HeapInuse) | |
fmt.Printf("heap alloc: %v\n", m.HeapAlloc) | |
fmt.Printf("next GC: %v\n", m.NextGC) |
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 ( | |
"encoding/json" | |
"fmt" | |
"reflect" | |
"strings" | |
) | |
type Product struct { |
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 ( | |
"encoding/json" | |
"fmt" | |
) | |
type Record struct { | |
SiteId string `json:"site_id"` | |
JsonData interface{} `json:"json_data"` |
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
cat ip-ranges.json | jq '.prefixes' | jq '.[]' | jq '.service = "EC2"' | jq '.region = "us-east-1"' | jq '.ip_prefix' > ec2-us-east-1-ranges.txt |
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
docker ps -a | grep "weeks ago" | awk '{print $1}' | xargs docker rm |
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
geoip_country /usr/share/GeoIP/GeoIP.dat; | |
map $geoip_country_code $allowed_country { | |
default no; | |
US yes; | |
} | |
geo $inNet { | |
default no; | |
10.0.0.0/8 yes; |
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
# Get the charset of a table | |
SELECT CCSA.character_set_name FROM information_schema.`TABLES` T, | |
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA | |
WHERE CCSA.collation_name = T.table_collation | |
AND T.table_schema = "schemaname" | |
AND T.table_name = "tablename"; | |
# Get a bunch of details about a table including its collation | |
SHOW TABLE STATUS IN dbname like 'tablename' |
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
var util = require('util'), | |
fs =require('fs'); | |
// Print a nested object to the console for full inspection | |
console.log(util.inspect(data, showHidden=false, depth=16, colorize=true)); | |
// Print a thing to a file | |
fs.writeFile('debug.txt', aThing, function(err) { | |
if (err) console.log('Write error for some reason!'); | |
}); |
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
[login] | |
password = abc123 |
NewerOlder