Skip to content

Instantly share code, notes, and snippets.

@ezr
ezr / http-upload-server.go
Last active May 23, 2023 04:25
HTTP server to accept file uploads
package main
/* Taken from https://github.com/TannerGabriel/learning-go/tree/master/beginner-programs/FileUpload with some tweaks
*/
import (
"flag"
"fmt"
"html/template"
"io"
@ezr
ezr / index.html
Last active January 18, 2023 04:06
Google Cloud function to create QR codes
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title></title>
<style>
</style>
</head>
@ezr
ezr / stopwatch.go
Last active October 3, 2022 20:10
A CLI stopwatch
package main
import (
"fmt"
"os"
"time"
"github.com/gdamore/tcell/v2"
"github.com/ltcsuite/lnd/ticker"
"github.com/mattn/go-runewidth"
@ezr
ezr / tealdeer-config.toml
Created July 3, 2022 03:03
Config file for tealdeer (TLDR) with lighter colors than the default
[style.description]
underline = false
bold = false
italic = false
[style.command_name]
foreground = { rgb = { r = 255, g = 255, b = 255 } }
underline = false
bold = false
italic = false
@ezr
ezr / comm.py
Created May 25, 2022 03:27
similar to unix comm command
#!/usr/bin/env python3
# Similar to the unix tool comm.
# Does not require input to be in sorted order.
# Defaults to finding the intersection of two lists.
import argparse
def slurp(fname):
f = open(fname)
@ezr
ezr / cut-media.py
Last active December 23, 2021 07:42
ffmpeg wrapper for cutting files
#!/usr/bin/env python3
import argparse
import os
import random
from re import fullmatch
from shutil import copyfile
from string import ascii_letters
import subprocess
import sys
@ezr
ezr / cheat.py
Created December 3, 2021 03:56
Print out a cheat sheet, falls back to tldr pages
#!/usr/bin/env python3
# depends on:
# https://github.com/sharkdp/bat
# https://github.com/tldr-pages/tldr
from glob import glob
from os import listdir, environ
import subprocess
from sys import argv
@ezr
ezr / zip-args.py
Created November 18, 2021 02:57
takes lists and merges them into columns
#!/usr/bin/env python3
import argparse
from sys import argv, stderr
parser = argparse.ArgumentParser(description='zip together lists')
parser.add_argument("-s", "--separator", default=" ", help='character to separate items', required=False)
parser.add_argument("lists", nargs="+")
args = parser.parse_args()
@ezr
ezr / portchecker.go
Created October 12, 2021 17:47
Google cloud function to scan a given IP/TCP port.
package portchecker
/* A Google cloud function that takes an address and a TCP port.
It scans the port and tells you whether its open or not.
If "addr" is not supplied, then it scan the requestor.
Example usage:
$ curl --header "Api-Key: $API_KEY" --data "port=443&addr=142.250.65.174" https://us-region-projectname.cloudfunctions.net/portchecker
*/
@ezr
ezr / printf-loop.sh
Created September 22, 2021 00:45
Print the supplied format once for each line of stdin
#!/usr/bin/env bash
USAGE=$(cat <<-END
Error: no argument supplied.
This program prints the template once for each line of stdin. It only substitutes one variable in the printf format string.
Usage:
$0 <printf_format> < data