Skip to content

Instantly share code, notes, and snippets.

View raylee's full-sized avatar

Ray Lee raylee

View GitHub Profile
@raylee
raylee / analyze.go
Created November 12, 2015 16:16 — forked from nf/analyze.go
'spent' script to log where time is spent
package main
import (
"bufio"
"fmt"
"os"
"regexp"
"sort"
"strconv"
"strings"
@raylee
raylee / main.go
Created August 4, 2016 03:35 — forked from mschoebel/main.go
Snippet: login/logout (Golang)
package main
import (
"fmt"
"github.com/gorilla/mux"
"github.com/gorilla/securecookie"
"net/http"
)
// cookie handling
@raylee
raylee / sse.go
Created November 26, 2016 03:29 — forked from schmohlio/sse.go
Example SSE server in Golang
// v2 of the great example of SSE in go by @ismasan.
// includes fixes:
// * infinite loop ending in panic
// * closing a client twice
// * potentially blocked listen() from closing a connection during multiplex step.
package main
import (
"fmt"
"log"
# The below is a tiny example using 'astral', a Python module which calculates sun and moon event times.
# see its documentation at http://pythonhosted.org/astral/ . This example calculates the length of a day
# for 12/2016, at San Luis Obispo, CA, elevation 100.
# `pip install astral` will install the dependency
from astral import *
from datetime import date
a = Astral()

Keybase proof

I hereby claim:

  • I am raylee on github.
  • I am raylee (https://keybase.io/raylee) on keybase.
  • I have a public key ASBe7rOTbBLWffDxnEdPyJ_6rIzSZ6YrY7oVbKMz3chdQwo

To claim this, I am signing this object:

@raylee
raylee / icbm.service
Last active March 18, 2021 19:08
Example installation of golang service under Debian systemd
# /etc/systemd/system/icbm.service
[Unit]
Description=Internet Connected Beverage Monitor data server
Documentation=https://lunarville.org
Wants=network.target
After=network.target
[Service]
Type=simple
@raylee
raylee / appify
Created January 26, 2020 23:35 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@raylee
raylee / macapp.go
Created February 20, 2020 18:38 — forked from mholt/macapp.go
Distribute your Go program (or any single binary) as a native macOS application
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
//
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5
//
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
//
// Example use:
@raylee
raylee / make-openbsd-virt
Last active May 25, 2020 02:57
example of creating an openbsd 6.6 virtual machine with virt-install / kvm
#!/bin/bash
OWNER=libvirt-qemu:libvirtd
RELEASE=https://cloudflare.cdn.openbsd.org/pub/OpenBSD/6.6/amd64
function sudo {
command sudo -p "Please enter password for %u@%h to fiddle with virtual machines: " ls /dev/null >/dev/null
command sudo "$@"
}