Skip to content

Instantly share code, notes, and snippets.

View jzelinskie's full-sized avatar
💾
don't copy that floppy

Jimmy Zelinskie jzelinskie

💾
don't copy that floppy
View GitHub Profile
@jzelinskie
jzelinskie / tailscale.sh
Created May 25, 2021 03:44
@tailscale EdgeOS `/config/scripts/post-config.d` script
#!/bin/sh
name="tailscale"
exe="/config/tailscale/tailscaled"
cmd="$exe --state=/config/tailscale/tailscaled.state --port 41641"
is_running() {
sudo ifconfig tailscale0 > /dev/null 2>&1
}
@jzelinskie
jzelinskie / config
Last active January 18, 2024 19:23
generate a knot-resolver (kresd) blacklist.rpz from pihole sources
-- Refer to manual: https://knot-resolver.readthedocs.io/en/latest/daemon.html#configuration
-- Listen on all interfaces (localhost would not work in Docker)
net.listen('0.0.0.0')
net.listen('0.0.0.0', 853, {tls=true})
-- Auto-maintain root TA
trust_anchors.file = '/data/root.keys'
-- Load Useful modules
@jzelinskie
jzelinskie / main.go
Created June 4, 2017 06:45
mario kart64 rng in Go
package main
import "fmt"
func SuperMario64RNG(input uint16) uint16 {
if input == 0x560A {
input = 0
}
var s0 uint16 = uint16(uint8(input) << 8)
s0 = s0 ^ input
@jzelinskie
jzelinskie / email.txt
Created November 29, 2016 20:15
Alpine-SecDB License
Delivered-To: jimmy.zelinskie@coreos.com
Received: by 10.237.52.230 with SMTP id x93csp1047052qtd;
Mon, 14 Nov 2016 12:13:31 -0800 (PST)
X-Received: by 10.200.56.253 with SMTP id g58mr8090851qtc.201.1479154411609;
Mon, 14 Nov 2016 12:13:31 -0800 (PST)
Return-Path: <ncopa@alpinelinux.org>
Received: from newmail.tetrasec.net (mail.tetrasec.net. [74.117.189.117])
by mx.google.com with ESMTP id s23si16209759qka.36.2016.11.14.12.13.31;
Mon, 14 Nov 2016 12:13:31 -0800 (PST)
Received-SPF: neutral (google.com: 74.117.189.117 is neither permitted nor denied by best guess record for domain of ncopa@alpinelinux.org) client-ip=74.117.189.117;
@jzelinskie
jzelinskie / client.go
Last active October 27, 2021 03:37
grpc bidirectional streams in golang
package main
import (
"log"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
pb "github.com/jzelinskie/grpc/simple"
@jzelinskie
jzelinskie / Dockerfile
Created June 29, 2015 21:03
example Quay.io cache buster
# vim:ft=dockerfile
FROM phusion/baseimage:latest
# Install the dependencies.
# Change the comment on the line below to bust the cache and refresh the apt-cache.
RUN apt-get update # 24JUN2015

Keybase proof

I hereby claim:

  • I am jzelinskie on github.
  • I am jzelinskie (https://keybase.io/jzelinskie) on keybase.
  • I have a public key whose fingerprint is 306E 99CB 7069 D6B1 8943 B14F AB71 936A 73BD 25F1

To claim this, I am signing this object:

@jzelinskie
jzelinskie / main.go
Last active August 29, 2015 14:04
print an infohash
package main
import (
"crypto/sha1"
"fmt"
"io/ioutil"
"log"
"net/url"
"github.com/chihaya/bencode"
@jzelinskie
jzelinskie / reservoir_sampling.py
Last active January 2, 2016 10:19
Select a random element from a stream with uniform probability (we only have access to the current element, and a function to get the next element which returns EOF when at the end of the stream).
import random
def uniform_random_from_stream(stream):
""" Returns a random number from an enumerable with uniform probability
by using a "reservoir sampling" algorithm """
reservoir = []
sample_count = 1
for index, item in enumerate(stream):
if index < sample_count:
@jzelinskie
jzelinskie / ocaml_gotchas.md
Last active December 29, 2015 03:48
OCaml Gotchas

a list of OCaml complexities extracted from Real World OCaml

arrays are by default mutable (and the syntax is crazy)

let array = [| "this";"is";"a";"array"; |];;
(* val array : string array = [|"this"; "is"; "a"; "array"|] *)

(** accessing a value *)
array.(2);;