This is a SCRIPT-8 cassette.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: pink; icon-glyph: kiwi-bird; | |
const home = await (new Request("https://chicken.photos")).loadString() | |
const chickenLine = home.split("\n").filter(x=>x.match(/<a href="\/\d+">/))[0] | |
const m = chickenLine.match(/a href="([^"]+)"><img .*src="([^"]+)"/) | |
const chickenUrl = "https://chicken.photos" + m[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lat_lon(thing) { | |
return { | |
"lat": thing.lat || thing.latitude, | |
"lon": thing.lon || thing.longitude, | |
} | |
} | |
function distance(loc1, loc2) { | |
loc1 = lat_lon(loc1) | |
loc2 = lat_lon(loc2) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"math/rand" | |
"sort" | |
"testing" | |
) | |
func BenchmarkInsertSorted(b *testing.B) { | |
data := make([]int, b.N) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# This script reads a journal located at the basedir in the following format: | |
# YYYY/MM/journal-entry.md (I usually have a YYYY-MM-DD HH-MM-SS Mon.md | |
# 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 |
I hereby claim:
- I am apiarian on github.
- I am apiarian (https://keybase.io/apiarian) on keybase.
- I have a public key ASDql2jnKyQKDqepzcSb1x9Rxxw-PGFC0ajwDZsfzZPX3wo
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pingcheck = hs.menubar.new() | |
function pingUpdate() | |
pingcheck:setTitle('⥌'..pingcheck:title()) | |
local p = hs.network.ping('example.com', 3) | |
hs.timer.doAfter(4, function() | |
p:cancel() | |
local avg = p:summary():match('%/(%d+)%.%d+%/') | |
if avg == nil or avg == '0' then | |
pingcheck:setTitle('∞') | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( (1 or 2 or 3) and (not (4 and (5 or 6 ) ) ) ) | |
{ | |
"operator": "AND", | |
"subsections": [ | |
{ | |
"operator": "OR", | |
"entities": [ 1, 2, 3 ] | |
}, | |
{ |
NewerOlder