Skip to content

Instantly share code, notes, and snippets.

@jswank
jswank / vi.md
Last active April 27, 2023 14:35
Manual for OpenVi

VI(1) - General Commands Manual

NAME

ex, vi, view - text editors

SYNOPSIS

ex [-FRrSsv]

flags := ""
# you're looking at it!
help:
@just --list
# Usage: `just init` or `just init prod`
# Do the initial software install & config for a host.
init env="staging":
ansible-playbook -l {{ env }} {{ flags }} base_playbook.yml
@jswank
jswank / queue_checks.json
Created January 8, 2014 17:19
Example Sensu check, which only alerts after 10 failures on a 60 second interval, and won't alert on nights or weekends.
{
"checks": {
"noisy_queue_check": {
"handler": "default",
"command": "/etc/sensu/plugins/check-queue-length.rb",
"interval": 60,
"refresh": 60,
"occurrences": 10,
"subscribers": [
"workers"

Keybase proof

I hereby claim:

  • I am jswank on github.
  • I am jswank (https://keybase.io/jswank) on keybase.
  • I have a public key ASCeN1kOZ-wyD9sF5Nxvgqm61bcw5N3HPyGYLxAJ5AbzUQo

To claim this, I am signing this object:

Authentication

gister uses GitHub OAuth authentication. A token must be generated once and then can be used for all your gister needs. To generate an OAuth token, run:

$ curl -s -u github_username \
       -d '{"scopes": ["gist"], "note": "commandline gister"}' \
 https://api.github.com/authorizations
@jswank
jswank / example.go
Created December 6, 2011 17:21
Check for existence of key in map
package main
import "fmt"
func main() {
m := make(map[string]string)
if m["foo"] == "" {
fmt.Println("No such key in map");
}
@jswank
jswank / example.go
Created December 6, 2011 16:34
Example Code
package main
import (
"fmt"
"os"
)
func foo(i int) int {
throw_if (i == 42,"foo: 42 not supported")
@jswank
jswank / go-hello-world.go
Created November 11, 2011 00:57
Hello World- Go
package "main"
import "fmt"
func main() {
fmt.Println("Hello World!")
}
@jswank
jswank / nil-map.go
Created November 11, 2011 01:07
Struct w/ nil-map; Printf w/ bool values
package main
import "fmt"
type Foo struct {
exists map[string] bool
}
func newFoo() (*Foo) {
exists := make(map[string] bool)

A bar chart.