Skip to content

Instantly share code, notes, and snippets.

We couldn’t find that file to show.
@scottopell
scottopell / simpleget.go
Last active September 1, 2022 15:50
Where does Go get its trusted CAs from?
package main
import (
"crypto/tls"
"fmt"
)
// go build && strace -o strace-out.txt -f -e trace=file ./simpleget
func main() {
conn, err := tls.Dial("tcp", "www.google.com:443", nil)
@scottopell
scottopell / serversetup.md
Last active April 18, 2020 16:28
Just random shit that I always have to look up when I'm setting up a server
@scottopell
scottopell / launch.json
Created March 31, 2018 15:27
How to debug jest tests with create-react-app-ts scripts
// This took me way too long to figure out.
// Needs node 8.4.0 or greater to work (I think, based on https://github.com/nodejs/node/issues/7593#issuecomment-322966866)
// The magic sauce here is that react-scripts-ts/scripts/test.js creates an inline jest config
// that it passes through. This does things like map css files properly, so if you try to use
// jest directly then it won't work.
{
"version": "0.2.0",
"configurations": [
{
var Benchmark = require('benchmark');
var suite = new Benchmark.Suite;
var createHash = require('crypto').createHash;
suite.add('md2', () => {
createHash('md2').update('HELLO WORLD').digest('hex');
})
.add('md4', () => {
@scottopell
scottopell / mp3_archiving.md
Last active December 10, 2017 18:20
Audio archive/management/conversion for audiobooks/podcasts

Scenario

You have a large audio file that has been split into multiple mp3s.

Goal

You want to merge these and convert to a m4a (optional) so that you can use it with https://github.com/scottopell/audiobook-podcast

Steps:

# Combine MP3s
ffmpeg -i "concat:$(ls *.mp3 | tr '\n' '|')" -acodec copy out.mp3
@scottopell
scottopell / setup_hc2.markdown
Last active February 24, 2020 08:03
Setup torrent + media server on Orange Pi HC2

Orange pi HC2 setup

This is my 3rd iteration of this guide, and now it appears that armbian officially supports the orange pi pc2!

Goals

  • rtorrent
  • plex
  • flood (or similar rtorrent web interface)
  • support external usb3 hd with exfat
@scottopell
scottopell / freeview_filter.markdown
Created September 2, 2017 15:29
DirectTV Now FreeVIEW filter out subscriber only shows

DirectTV Now added a FreeVIEW thing where you can watch some tv shows for free, but they don't show you only the shows that are available on "FreeVIEW", because that would be too convenient.

Luckily, they helpfully mark these subscriber only shows with a badge on the /watch/shows endpoint.

Here's a bookmarklet to hide the subscriber only shows.

javascript:document.querySelectorAll("[data-label='SUBSCRIBE']").forEach( (el) => { el.parentNode.parentNode.parentNode.parentNode.style.display = 'none'; });
@scottopell
scottopell / zpty.md
Last active November 27, 2023 12:50
zpty

zpty

Zsh has a feature called zpty which creates a pseudo-terminal in the background.

According to the docs, this can be useful to run a program in the background that expects to be run in a normal terminal environment.

Some zsh themes such as pure use this to run commands asynchronously. Pure uses the zsh plugin zsh-async for this.

@scottopell
scottopell / xz_to_google_cloud.md
Created August 19, 2017 15:51
Compress files with xz and upload archive to google cloud

I always forget these steps and have to google for them, even though they're super simple

Prereq:

  • pip install gsutil
  • gsutil config, have your project id ready.
  1. tar --create --verbose --xz --file images.tar.xz /directory/containing/images/*
  2. gsutil cp images.tar.xz gs://<bucket name>