Skip to content

Instantly share code, notes, and snippets.

@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)
@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 / 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");
}

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 / 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"
@jswank
jswank / central-sync01.pem
Last active August 29, 2015 13:56
Central Sync Public Certficates
-----BEGIN CERTIFICATE-----
MIIDijCCAnKgAwIBAgIGATrcnHuJMA0GCSqGSIb3DQEBBQUAMIGEMS0wKwYDVQQD
DCRhZTA0MDQ2ZC01MTQ1LTRkZmItYWJjMi1kNjAxZDlhOTBjYmIxDjAMBgNVBAsM
BU5leHVzMREwDwYDVQQKDAhTb25hdHlwZTEWMBQGA1UEBwwNU2lsdmVyIFNwcmlu
ZzELMAkGA1UECAwCTUQxCzAJBgNVBAYTAlVTMCAXDTEyMTEwNzIwNDI1M1oYDzIx
MTIxMDE0MjA0MjUzWjCBhDEtMCsGA1UEAwwkYWUwNDA0NmQtNTE0NS00ZGZiLWFi
YzItZDYwMWQ5YTkwY2JiMQ4wDAYDVQQLDAVOZXh1czERMA8GA1UECgwIU29uYXR5
cGUxFjAUBgNVBAcMDVNpbHZlciBTcHJpbmcxCzAJBgNVBAgMAk1EMQswCQYDVQQG
EwJVUzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKr2VhSj/nWDS1FD
JGY9wocx/+sq2CitooAye2DWOI8K5S0rMoS2fU2hZlJrANX5Ah2/09i2IQ8/yvDs
@jswank
jswank / stderr.txt
Created February 13, 2014 22:05
strace & stderr
[ Process PID=21564 runs in 32 bit mode. ]
ACE_Semaphore::ACE_Semaphore: Permission denied
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /var/opt/ibm/appscansource/logs/osa.log (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:214)
at java.io.FileOutputStream.<init>(FileOutputStream.java:138)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:272)
at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:156)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:151)

A bar chart.

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: