Skip to content

Instantly share code, notes, and snippets.

@kristi
kristi / auto-restart
Created September 4, 2011 20:39
auto-restart passenger
#!/bin/bash
# Restarts passenger after any *.py *.html or *.po files are saved
#
# Requires inotify-tools
appDir="/home/user/site.com/appname"
siteDir=$(dirname "$appdir")
# Make sure app directory exists
@kristi
kristi / back 10 seconds
Last active January 2, 2016 02:09 — forked from nicwolff/back 10 seconds
set isPlaying flag even if document is not playing
if application "VLC" is running then
tell application "VLC"
step backward
end tell
end if
property step : 10
if application "QuickTime Player" is running then
tell application "QuickTime Player"
set playerPosition to (current time of front document) - step
set movieDuration to duration of front document
@kristi
kristi / template.go
Created January 16, 2014 09:23
A template for parsing integers from Stdin. InputParser struct uses embedding (go-flavored inheritance, see http://golang.org/doc/effective_go.html#embedding ) While it may be simpler to use multiple calls to fmt.Scan or fmt.Scanf, Scan is slow for really large arrays. Don't mix Scan calls with the bufio.Reader because the Reader is buffered so …
package main
import (
"fmt"
"strings"
"io"
"bufio"
"os"
"strconv"
)
brew list -1 | while read line; do brew unlink $line; brew link $line; done
for x in sqlite openssl readline; do brew unlink $x; brew link --force $x; done
@kristi
kristi / install-adoptopenjdk.sh
Created March 12, 2019 04:25
Install AdoptOpenJdk
#!/usr/bin/env bash
set -ex
cd /tmp
VERSION="8u202-b08"
VERSION_WITHOUT_DASH="${VERSION/-/}"
TARBALL="OpenJDK8U-jre_x64_linux_hotspot_${VERSION_WITHOUT_DASH}.tar.gz"
CHECKSUM="b3f9934c6fc83fb2e76a4ded31367e5312013e27d36eac82a6fe1423aae394ce"
@kristi
kristi / latest-amazon-linux-2.tf
Last active March 12, 2019 23:13
terraform - latest amazon linux 2 ami
data "aws_ami" "latest_amazon_linux_2" {
most_recent = true
filter {
name = "name"
values = ["*amzn2-ami-hvm*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}