Skip to content

Instantly share code, notes, and snippets.

View ddrscott's full-sized avatar

Scott Pierce ddrscott

View GitHub Profile
@ddrscott
ddrscott / Makefile
Created January 3, 2023 17:41
Compile a bunch of pixel art frames into an animated gif.
frames=$(shell ls -tr bouncing-ball/*.png)
bouncing-ball.gif: $(frames)
convert -delay 12 -loop 0 -dispose previous -resize 256x -filter Point $(frames) $@
(
(imgs, h) => imgs.forEach((i, idx) => {
let l = document.createElement('a');
l.href=i.src;
l.download=`image-${idx}.png`;
l.innerText=l.download;
h.appendChild(l)
})
)(
d.querySelectorAll("#jmuse-scroller-component img[alt]"),
version: '3'
services:
db:
image: postgres:11
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=secret
volumes:
- database-data:/var/lib/postgresql/data/
- .:/app
"""
See __test_time function for example use
>>> import pathlib
>>> pathlib.Path("__test_time.pickle").unlink(missing_ok=True)
>>> a = __test_time() # Get current time
>>> import time
>>> time.sleep(0.1)
>>> __test_time() - a # Time should be the same since it is cached.
0.0
@ddrscott
ddrscott / color-picker-box.js
Created April 26, 2022 14:58
Simple color picker input maker. Every time it's used. It will append to existing container.
((d)=>{
let z=d.querySelector("#__z");
if (!z) {
z = d.createElement("div");
z.setAttribute("id", "__z");
z.setAttribute("style", "z-index: 999999; padding: 1em; position:fixed; display:flex; width:100vw; top: 0px; left:0px; align-items: center; flex-direction: row; flex-wrap: nowrap; align-content: space-around; justify-content: center; ");
d.body.appendChild(z);
}
let e=d.createElement("input");
e.setAttribute("type", "color");
@ddrscott
ddrscott / index.html
Created March 24, 2022 19:08
Simple Leaflet.js Map
<div id="map"></div>
@ddrscott
ddrscott / k-watch-all.sh
Created March 23, 2022 21:30
watch all the logs from everything in a namespace
kubectl logs -fl 'app!=empty' --all-containers --max-log-requests 999
# specify namespace
kubectl -n my_project logs -fl 'app!=empty' --all-containers --max-log-requests 999
# in case you have a label `app` equal to `empty`
kubectl -n my_project logs -fl 'any_existing_label!=a_real_value' --all-containers --max-log-requests 999
kubectl -n my_project logs -fl 'foo!=bar' --all-containers --max-log-requests 999
@ddrscott
ddrscott / nvme-ssd-vs-raid6.md
Last active March 11, 2022 23:31
Just some benchmarking using `fio` for my homelab.

Use fio to benchmark disk.

fio --randrepeat=1 --ioengine=libaio --direct=1 \
    --gtod_reduce=1 --name=test --bs=4k \
    --iodepth=64 --readwrite=randrw \
    --rwmixread=75 --size=1G \
    --filename=/mnt/path/to/test/target/deleteme
@ddrscott
ddrscott / WireGuard_Setup.md
Last active January 18, 2022 16:19 — forked from chrisswanda/WireGuard_Setup.txt
Stupid simple setting up WireGuard - Server and multiple peers

Install WireGuard via whatever package manager you use. For me, I use apt.

$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard

MacOS

@ddrscott
ddrscott / Makefile
Last active December 23, 2021 17:42
Concatenating two parts of a video into a gif
FRAMERATE:=12
shoyo-spike.gif: clip-a.gif clip-b.gif
ffmpeg -i clip-a.gif -i clip-b.gif \
-filter_complex 'concat=n=2:v=1:a=0,scale=480:-1' \
-r ${FRAMERATE} -y $@
clip-a.gif:
ffmpeg -ss 06:08 -to 06:21.5 -i source-clip.mp4 -r ${FRAMERATE} -y $@