Skip to content

Instantly share code, notes, and snippets.

View graphaelli's full-sized avatar

Gil Raphaelli graphaelli

View GitHub Profile
@graphaelli
graphaelli / Dockerfile
Last active May 14, 2017 04:25
firefox in ubuntu 16.04 docker container on mac osx
FROM ubuntu:16.04
# based on http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/
RUN apt-get update && apt-get install -y firefox
RUN useradd -u 501 -m developer
USER developer
ENV HOME /home/developer
CMD /usr/bin/firefox
#!/usr/bin/env python
import importlib
import sys
def actions(module):
mod = importlib.import_module(module)
for attrib in dir(mod):
package main
import (
"log"
"net/http"
"time"
)
// https://raw.githubusercontent.com/zenazn/goji/master/web/middleware/nocache.go
#!/bin/bash
gotest() {
clear
go test -bench .
}
gotest
export -f gotest
fswatch -o *go | xargs -t -I{} bash -c gotest
@graphaelli
graphaelli / scp.terminal
Last active November 25, 2017 15:19
Mac OSX Terminal Settings
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlueColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw
LjE0OTAxOTYwNzggMC40OTQxMTc2NDcxIDAuOTEzNzI1NDkwMgAQAYAC0hAREhNaJGNs
YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp
#!/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 \
@graphaelli
graphaelli / aws-session-env.py
Created December 29, 2017 18:21
Export environment variables for AWS cli w/MFA.
#!/usr/bin/env python
"""Export environment variables for AWS cli w/MFA.
eval $(aws-session-env.py $1)
"""
import argparse
import os
import boto3
@graphaelli
graphaelli / somaxconn.go
Created March 21, 2018 20:50
fetch kern.ipc.somaxconn
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)
}
@graphaelli
graphaelli / Gopkg.toml
Created March 23, 2018 21:19
messing around with the prometheus client
# 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"
@graphaelli
graphaelli / number_test.go
Created March 27, 2018 20:56
useNumber benchmark
package main
import (
"bytes"
"encoding/json"
"testing"
)
var (
data map[string]interface{}