Skip to content

Instantly share code, notes, and snippets.

@oxtoacart
oxtoacart / tcpproxy.go
Created August 31, 2023 12:33
Simple tcp proxy to a single origin address
package main
import (
"log"
"net"
"os"
"github.com/getlantern/netx"
)
type Display interface {
DrawSomething()
}
type display struct {}
func (d *display) DrawSomething() {
...
}
type Display struct {}
func (d *Display) DrawSomething() {
...
}
type Computer struct {
Display *Display
}
# Uses data from the GFED4.1 dataset - https://daac.ornl.gov/VEGETATION/guides/fire_emissions_v4_R1.html
import csv
import h5py # pip install h5py
with open('/tmp/burn.csv', mode='w') as csvfile:
csvwriter = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
csvwriter.writerow(["Year", "Area Burned"])
for year in range(1997, 2016):
print("year %s" % year)
@oxtoacart
oxtoacart / badhttp.go
Created December 13, 2019 15:52
demonstrates what happens when transport closes idle connections
package main
import (
"context"
"fmt"
"io"
"log"
"net"
"net/http"
"os"
@oxtoacart
oxtoacart / oratory_to_rew.go
Created July 22, 2019 01:02
Utility to convert oratory1990's CSV measurements to a Room EQ Wizard compatible format
// This program converts csv measurements from oratory1990 into a format
// suitable for importing into Room EQ Wizard, with SPL normalized to 90dB.
package main
import (
"os"
"io"
"encoding/csv"
"fmt"
"strconv"
package main
import (
"net"
"sort"
"log"
"strconv"
)
func main() {
@oxtoacart
oxtoacart / origin.go
Created May 9, 2019 18:09
HTTP server that returns unlimited data
package main
import (
"flag"
"net"
"net/http"
"strings"
"github.com/getlantern/golog"
)
@oxtoacart
oxtoacart / apply_crossfeed.bash
Last active January 6, 2019 18:00
Apply advanced crossfeed using Redline Monitor
#!/bin/bash
# Set up parameters
in=`realpath "${1}"`
echo $in
indir="${in%/*}"
infile="${in##*/}"
outdir="${indir}_headphone"
tmpin="/tmp/in_${infile}.flac"
tmpout="/tmp/out_${infile}.flac"
@oxtoacart
oxtoacart / apply_crossfeed.bash
Created December 27, 2018 03:57
Script for applying advanced crossfeed using Redline Monitor
#!/bin/bash
# Set up parameters
in=`realpath "${1}"`
echo $in
indir="${in%/*}"
infile="${in##*/}"
outdir="${indir}_headphone"
mkdir -p "$outdir"
tmpin="/tmp/in_${infile}"