Skip to content

Instantly share code, notes, and snippets.

View wader's full-sized avatar
🦫

Mattias Wadman wader

🦫
View GitHub Profile
@wader
wader / gist:17934fb0bc389f5033af7b61e6f4f5d4
Created February 4, 2019 15:40
curl --trace-ascii bla -F method=recognize -F return_itunes_audios=yeeee -F itunes_country=us -F audio_format=wav -F [email protected] https://api.audd.io
This file has been truncated, but you can view the full file.
== Info: Rebuilt URL to: https://api.audd.io/
== Info: Trying 2606:4700:30::681b:9502...
== Info: TCP_NODELAY set
== Info: Connected to api.audd.io (2606:4700:30::681b:9502) port 443 (#0)
== Info: ALPN, offering h2
== Info: ALPN, offering http/1.1
== Info: Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
== Info: successfully set certificate verify locations:
== Info: CAfile: /etc/ssl/cert.pem
CApath: none
@wader
wader / wav.js
Created February 16, 2019 16:00
Javascript wav encoder
'use strict';
function dataViewWriteUTF8(view, offset, str) {
var l = str.length;
for (var i = 0; i < l; i++) {
view.setUint8(offset+i, str.charCodeAt(i));
}
}
// channels:
@wader
wader / racey_auxv.go
Last active June 23, 2019 19:04
/proc/$PID/auxv is racey on process create
// seems to known issue/behaviour in the kernel
package main
import (
"fmt"
"io/ioutil"
"log"
"os/exec"
)
@wader
wader / multiwritecloser.go
Last active July 14, 2019 09:36
MultiWriteCloser
type multiWriteCloser struct {
writers io.Writer // is a multi writer
closers []io.Closer
}
func MultiWriteCloser(writerClosers ...io.WriteCloser) io.WriteCloser {
w := []io.Writer{}
c := []io.Closer{}
for _, wc := range writerClosers {
w = append(w, wc)
@wader
wader / docker.sh
Created July 19, 2019 14:23
Run golang docker container for current directory sharing build cache and module pkg source directory with host
docker run --rm -ti \
-w "$PWD" \
-v "$PWD:$PWD" \
-v "$(go env GOPATH)/pkg":"$(docker run --rm golang:1.12 go env GOPATH)/pkg" \
-v "$(go env GOCACHE):$(docker run --rm golang:1.12 go env GOCACHE)" \
golang:1.12
@wader
wader / pipetest.go
Created October 13, 2019 13:24
go pipe buffer test
package main
import (
"os"
)
func main() {
pr, pw, _ := os.Pipe()
ghcurl(){
local p="$1"
shift
curl \
-s \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GITHUB_TOKEN" \
"$@" \
"$GITHUB_API_BASE_URL/$p"
}
@wader
wader / modd.conf
Last active July 14, 2021 02:28
Hex Fiend template development tricks
WAV.tcl {
prep: osascript \
-e 'tell application "System Events"' \
-e ' tell process "Hex Fiend"' \
-e ' click pop up button 1 of window 1' \
-e ' click menu item "WAV" of menu 1 of pop up button 1 of window 1' \
-e ' end tell' \
-e 'end tell'
}
@wader
wader / docker-dlv
Created April 5, 2020 12:12
vscode docker dlv
#!/bin/bash
if [ "$DOCKERDLV_IMAGE" = "" ]; then
echo "DOCKERDLV_IMAGE not set"
exit 1
fi
if [ "$DOCKERDLV_WORKSPACE_ROOT" = "" ]; then
echo "DOCKERDLV_WORKSPACE_ROOT not set"
exit 1
fi
RELO partial: readelf -l prog | grep GNU_RELRO
RELO full: readelf -d prog | grep BIND_NOW
PIE/ASLR: readelf -h prog | grep DYN
NX: readelf -W -l prog | grep GNU_STACK | grep -v RWE