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
Copyright 2018 Gil Raphaelli | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
the Software, and to permit persons to whom the Software is furnished to do so, | |
subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all |
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 ( | |
"bytes" | |
"encoding/json" | |
"testing" | |
) | |
var ( | |
data map[string]interface{} |
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
# Gopkg.toml example | |
# | |
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md | |
# for detailed Gopkg.toml documentation. | |
# | |
# required = ["github.com/user/thing/cmd/thing"] | |
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | |
# | |
# [[constraint]] | |
# name = "github.com/user/project" |
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
if somaxconn, err := unix.Sysctl("kern.ipc.somaxconn"); err != nil { | |
panic(err) | |
} else { | |
var backlog uint16 | |
r := strings.NewReader(somaxconn) | |
if err := binary.Read(r, binary.LittleEndian, &backlog); err != nil { | |
fmt.Println("binary.Read failed:", err) | |
} | |
fmt.Println(backlog) | |
} |
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
#!/usr/bin/env python | |
import elasticapm | |
from elasticapm.contrib.flask import ElasticAPM | |
from flask import Flask | |
# initialize using environment variables from elasticapm.contrib.flask import ElasticAPM | |
app = Flask(__name__) |
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 -e | |
if [ ! -d ${GOPATH} ]; then | |
echo missing GOPATH | |
exit 1 | |
fi | |
mv ${GOPATH} ${GOPATH}.$(date '+%Y%m%d_%H%M%S') | |
mkdir -p ${GOPATH} | |
go get -u -v \ |
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
#!/usr/bin/env python | |
"""Export environment variables for AWS cli w/MFA. | |
eval $(aws-session-env.py $1) | |
""" | |
import argparse | |
import os | |
import boto3 |
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 | |
gotest() { | |
clear | |
go test -bench . | |
} | |
gotest | |
export -f gotest | |
fswatch -o *go | xargs -t -I{} bash -c gotest |
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" | |
"net/http" | |
"time" | |
) | |
// https://raw.githubusercontent.com/zenazn/goji/master/web/middleware/nocache.go |
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
#!/usr/bin/env python | |
import importlib | |
import sys | |
def actions(module): | |
mod = importlib.import_module(module) | |
for attrib in dir(mod): |