Skip to content

Instantly share code, notes, and snippets.

View cassava's full-sized avatar

Ben Morgan cassava

View GitHub Profile
@cassava
cassava / fancy_yaml.py
Created February 22, 2022 07:45
Fancy YAML proof of concept in Python
#!/usr/bin/env python3
from typing import Optional, Dict
import os
import yaml
import jinja2
class FancyLoader(yaml.SafeLoader):
def __init__(self, stream):
@cassava
cassava / download-from-clipboard.sh
Created November 1, 2020 12:04
Bash script to download URLs from the clipboard.
#!/bin/bash
# Create a pipe for async communication
pipe=$(mktemp -u)
trap "rm -f $pipe" EXIT
if [[ ! -p $pipe ]]; then
mkfifo $pipe
fi
download_loop() {
@cassava
cassava / update_music2go.sh
Created June 27, 2019 08:28
Script to use lackey and convert to create low-quality music library.
#!/bin/sh
musicsource=/home/media/music
update_music2go() {
# Make source library read-only so I know I'm not fucking up somehow...
musicsource_tmp=${musicsource}_readonly
if [ -d ${musicsource_tmp} ]; then
echo "Something wrong here!"
exit 1

Keybase proof

I hereby claim:

  • I am cassava on github.
  • I am cassava (https://keybase.io/cassava) on keybase.
  • I have a public key ASAx869xkcAjQyO8QD5ObaGrJHG_sYuiwJvJFMN3gaiSxgo

To claim this, I am signing this object:

@cassava
cassava / filer.go
Created January 28, 2015 16:01
Serve a part of your filesystem while password protecting it.
// Copyright (c) 2014, Ben Morgan. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
package main
import (
"flag"
"log"
"net/http"
@cassava
cassava / countries.txt
Created July 13, 2014 15:34
Matching lines in a text via three letter substrings
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua and Barbuda
Argentina
Armenia
Australia
Austria
@cassava
cassava / manager.go
Created July 1, 2013 07:17
An idiom in Go for managing up to a fixed number of workers and separately post-processing the results.
package main
import (
"fmt"
"math/rand"
"strings"
"time"
)
// worker does work which takes a (variable) amount of time.
@cassava
cassava / binsel.go
Created June 28, 2013 06:58
Binary selection mechanism similar to Facemash.
package main
import (
"fmt"
"log"
"os"
"os/exec"
)
func run(imgs chan string, out chan string) {