Skip to content

Instantly share code, notes, and snippets.

Jim Kalafut kalafut

Block or report user

Report or block kalafut

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View go-snippets.md

Helpers that are meant to be copied, pasted and modified... not imported.

Cryptography

The secretbox library is intended to minimize the number of ways to screw things up, but using it still requires some setup.

func Seal(data, key []byte) []byte {
	if len(key) != 32 {
		panic("invalid key length")
	}
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@kalafut
kalafut / logical_system.go
Created Mar 30, 2018
Example that really slows vim-go's package comment folding
View logical_system.go
package vault
import (
"context"
"crypto/sha256"
"crypto/sha512"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
@kalafut
kalafut / django_init
Last active Dec 27, 2018
Simple creation of a single-app django project
View django_init
#!/bin/bash
#
# Simple creation of a single-app django project, as described in: https://zindilis.com/blog/2017/01/06/django-anatomy-for-single-app.html
#
# ./django_init foo
#
# This will result is the following flat structure:
#
# .
# └── foo
@kalafut
kalafut / example.go
Created Oct 11, 2015
Sample file that will generate gorename errors
View example.go
package main
// Running gorename -from example.go::Foo -to foo on this file will not work.
// There are multiple errors, but it appears that gorename stops after the first one.
//
// example.go:16:6: renaming this type "Foo" to "foo"
// example.go:21:6: conflicts with func in same block
//
// After commenting out or changing foo(), the errors moves down:
//
@kalafut
kalafut / pinextract.py
Created Jun 19, 2014
Retrieve bookmarks from Pindroid
View pinextract.py
import json
import sqlite3
output = []
conn = sqlite3.connect('PinboardBookmarks.db')
c = conn.cursor()
for row in c.execute("SELECT url, description, tags FROM bookmark"):
output.append({"href": row[0], "description": row[1], "tags": row[2]})
You can’t perform that action at this time.