Skip to content

Instantly share code, notes, and snippets.


Aleksandr Pasechnik apiarian

View GitHub Profile
# Aleksandr Pasechnik
# Goes through the Day One jounal and sets the Time Zone of each entry that
# doesn't already have one to the value of the *timezone* variable. Makes a
# backup copy of each entry it modified by adding a '.tzbak' to the filename.
# Ignores any entry that already has a '.tzbak' version.
# NOTE: base_dir may need to be adjusted to the correct Journal_dayone location
# NOTE: It is probably a good idea to have a full journal backup just in case
View main_test.go
package main
import (
func BenchmarkInsertSorted(b *testing.B) {
data := make([]int, b.N)
View nested_vs_compound_maps.go
go test -bench Map -run Map -benchmem -benchtime 10s
BenchmarkMapNestedPopulate-4 50000000 493 ns/op 72 B/op 1 allocs/op
BenchmarkMapNestedQuery-4 50000000 336 ns/op 1 B/op 1 allocs/op
BenchmarkMapCompoundPopulate-4 30000000 723 ns/op 209 B/op 0 allocs/op
BenchmarkMapCompoundQuery-4 50000000 387 ns/op 0 B/op 0 allocs/op
func BenchmarkMapNestedPopulate(b *testing.B) {
m := make(map[string]map[int64]int64)
#!/usr/bin/env python3
# This script reads a journal located at the basedir in the following format:
# YYYY/MM/ (I usually have a YYYY-MM-DD HH-MM-SS
# formatted entry name). It deletes the contents of the outputdir and replaces
# them with an HTML representation of the markdown files, complete with handy
# index pages and some keyboard navigation. Requires multimarkdown. Other files
# that might be in the basedir are copied to to the output directory structure
# alongside the generated HTML, so you can include things like images and even
# sounds in the markdown and they should "just work". Adjust as necessary. I

Keybase proof

I hereby claim:

  • I am apiarian on github.
  • I am apiarian ( on keybase.
  • I have a public key ASDql2jnKyQKDqepzcSb1x9Rxxw-PGFC0ajwDZsfzZPX3wo

To claim this, I am signing this object:

View Golang Channels

Golang Channels


  • send blocks forever
  • receive blocks forever


  • send blocks until received
  • receive blocks until sent
View hammerspoon ping.lua
pingcheck =
function pingUpdate()
local p ='', 3)
hs.timer.doAfter(4, function()
local avg = p:summary():match('%/(%d+)%.%d+%/')
if avg == nil or avg == '0' then
#!/usr/bin/env python3
# licence: ¯\_(ツ)_/¯
import requests
s = requests.Session()
d = {
'client_id': 'client_id',
'client_secret': 'client_secret',
View boolean.json
( (1 or 2 or 3) and (not (4 and (5 or 6 ) ) ) )
"operator": "AND",
"subsections": [
"operator": "OR",
"entities": [ 1, 2, 3 ]
You can’t perform that action at this time.