Skip to content

Instantly share code, notes, and snippets.

View andrewhampton's full-sized avatar
:shipit:

Andrew Hampton andrewhampton

:shipit:
View GitHub Profile
local grid = {}
local window = require 'mjolnir.window'
function grid.snap(win, x, y, w, h)
local newframe = {
x = x,
y = y,
w = w,
h = h,
}
app:
build: .
command: bundle exec rails server -b 0.0.0.0 --pid=/tmp/app.pid
volumes:
- .:/usr/src/app
links:
- proxy
environment:
- VIRTUAL_HOST=app.d
expose:
require "string"
os = require "os"
alert = require "alert"
local alert_threshold = read_config("alert_threshold") or 5
local alert_throttle_time = read_config("alert_throttle_time") or 300
local nanosecondsInASecond = 1000000000
alert.set_throttle(alert_throttle_time * nanosecondsInASecond)
local os = require "os"
local alert = require "alert"
alert.set_throttle(60 * 1e9)
local host1 = "box1"
local host2 = "box2"
while true do
local current_time = os.time() * 1e9
(defun go-coverage-current-file
(let ((coverage-file "/tmp/coverage.out")
(args (s-concat
"--coverprofile="
coverage-file)))
(go-test-run args)
(go-coverage coverage-file)))
@andrewhampton
andrewhampton / anonymous-gist.go
Created November 9, 2015 19:05
build a 302 redirect reponse in golang
// buildRedirect creates a 302 redirect for the request
func buildRedirect(request *http.Request) *http.Response {
log.Printf("transport: building redirect for: %s", request.URL.String())
response := &http.Response{
StatusCode: http.StatusFound,
Header: make(map[string][]string),
Body: buildEmptyBody()}
response.Header.Add("Location", request.URL.String())
return response
}
@andrewhampton
andrewhampton / index.js
Created August 31, 2016 13:25
Stupid Simple Poll Renderer
const {app, BrowserWindow, ipcMain} = require('electron')
const http = require('http')
const url = require('url')
app.disableHardwareAcceleration()
let window
app.once('ready', () => {
window = new BrowserWindow({
show: false,
@andrewhampton
andrewhampton / Dockerfile
Created October 17, 2017 15:10
Dockerfile for bundle-audit
FROM ruby:2.4.1
RUN gem install 'bundle-audit'
ADD Gemfile ./
ADD Gemfile.lock ./
# We never want the `bundle audit update` to be cached. So this will help bust
# the cache if you include this in your build command:
# `--build-arg CACHEBUST=$(date +%s)`
### Keybase proof
I hereby claim:
* I am andrewhampton on github.
* I am andrewhampton (https://keybase.io/andrewhampton) on keybase.
* I have a public key ASB_VmqoAx-RJVDx0xG6c-Z1K7Kpt4QvstZmWP-LkLFD9Qo
To claim this, I am signing this object: