Skip to content

Instantly share code, notes, and snippets.

# 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 April 1, 2021 01:23
something about asdot idk
package main
import (
"fmt"
"strconv"
"strings"
)
var testASN = []string{
"AS 6541",
@polynomialspace
polynomialspace / NDjsonTojsonArr.go
Last active March 24, 2021 05:40
ndjson -> json array (technically golang will take '\n' as a json sep where ndjson is '\r\n' but /shrug)
// NDjsonTojsonArr converts newline-delimited json (indented or minified)
// to a json array. Caller should handle cleanup on error.
func NDjsonTojsonArr(r io.Reader, w io.WriteCloser) error {
w.Write([]byte("["))
var m json.RawMessage
dec := json.NewDecoder(r)
err := dec.Decode(&m)
for {
if _, err = w.Write(m); err != nil {
@polynomialspace
polynomialspace / gobmarshal.go
Created February 26, 2021 11:14
similar marshal/unmarshal functions as other encoders for gob
func gobMarshal(v interface{}) ([]byte, error) {
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
err := enc.Encode(v)
return buf.Bytes(), err
}
func gobUnmarshal(data []byte, v interface{}) error {
dec := gob.NewDecoder(bytes.NewReader(data))
return dec.Decode(v)
@polynomialspace
polynomialspace / TokenActor_test.go
Last active December 29, 2020 19:31
WIP-y POC emulating the actor model in go. This snippet is intended to be implemented later in a larger project with a specific usecase after further modification.
package main
import (
"testing"
"time"
)
type TokenRequest struct {
Key string
Value string
@polynomialspace
polynomialspace / rMBP_ed25519.pub
Created September 26, 2020 02:12
rMBP_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMqrj2Ea7EsGHR5v6I9Trk7K2Y/52uvuMXGUvKBkIUF4 ash@MacBook-Pro
@polynomialspace
polynomialspace / optional.go2
Created June 25, 2020 03:31
Attempting to do optional type stuff in Go2 and doing a terrible job at it
package main
import (
"fmt"
)
type Optional(type T) struct {
p *T
}
package main
import (
"fmt"
"reflect"
)
func reverse(slice interface{}) interface{} {
/* Completely inefficient but syntactically "convenient" */
s := reflect.ValueOf(slice)
func strStr(haystack string, needle string) int {
foundpos := -1
if len(needle) < 1 {
return 0
}
if len(needle) > len(haystack) {
return foundpos
}
/* Find unique char nearest the end of 'needle' to skip with */
import (
"sort"
"strings"
)
func frequencySort(s string) string {
abcfreq := make([]struct {
chr rune
cnt int
}, 128)