Skip to content

Instantly share code, notes, and snippets.

View byteunits.go
// You can edit this code!
// Click here and start typing.
package byteunits
const (
_ = iota
KB = 1 << (10 * iota)
MB
GB
@polynomialspace
polynomialspace / main.go
Created Jan 7, 2022
`ip a` but only the parts you care about
View main.go
package main
import (
"fmt"
"net"
"os"
"text/tabwriter"
)
func main() {
View main.go
package main
import (
"fmt"
"runtime"
)
func trace() func() {
pc, file, line, _ := runtime.Caller(1)
fmt.Printf("%s:%d enter %s\n", file, line, runtime.FuncForPC(pc).Name())
@polynomialspace
polynomialspace / main.go
Created Dec 14, 2021
go1.18 mailboxes demo
View main.go
package main
import (
"context"
"fmt"
"time"
)
type Mailbox[T0, T1 any] struct {
ctx context.Context
View darwin-configuration.nix
{ config, pkgs, nixpkgs, ... }:
{
# These don't exist : (
# system.defaults.NSGlobalDomain."com.apple.AppleMultitouchTrackpad.Clicking" = true;
# system.defaults.NSGlobalDomain."com.apple.AppleMultitouchTrackpad.Dragging" = true;
system.defaults.NSGlobalDomain = {
NSAutomaticCapitalizationEnabled = false;
NSAutomaticDashSubstitutionEnabled = false;
@polynomialspace
polynomialspace / v3hsaddr.go
Created Jul 15, 2021
quick and dirty go impl of tor hsv3 onion address generation
View v3hsaddr.go
package main
import (
"crypto/ed25519"
"encoding/base32"
"encoding/hex"
"fmt"
"strings"
"golang.org/x/crypto/sha3"
View etc_nix_nix.conf
# WARNING: this file is generated from the nix.* options in
# your NixOS configuration, typically
# /etc/nixos/configuration.nix. Do not edit it!
max-jobs = auto
cores = 0
sandbox = false
substituters = https://cache.nixos.org/
trusted-substituters =
View cidragg.go
// go get "inet.af/netaddr"
// echo '[ "208.80.44.0/22", "208.80.44.0/23", "208.80.44.0/24", "208.80.45.0/24", "208.80.46.0/23", "208.80.46.0/24", "208.80.47.0/24" ]' | go run main.go -json -
package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"io"
View combine.sh
# Glues 4 files into one
ffmpeg -i 1xtra.wav.mp4 -i radio1.wav.mp4 -i radio2.wav.mp4 -i radio4.wav.mp4 -filter_complex "
nullsrc=size=640x480 [base];
[0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];
[1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];
[2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft];
[3:v] setpts=PTS-STARTPTS, scale=320x240 [lowerright];
[base][upperleft] overlay=shortest=1 [tmp1];
[tmp1][upperright] overlay=shortest=1:x=320 [tmp2];
@polynomialspace
polynomialspace / asconv.go
Last active Apr 1, 2021
something about asdot idk
View asconv.go
package main
import (
"fmt"
"strconv"
"strings"
)
var testASN = []string{
"AS 6541",