Skip to content

Instantly share code, notes, and snippets.

@yottatsa
yottatsa / hayes
Created February 28, 2023 10:27
Hayes modem dummy plug
#!/usr/bin/expect
#
# responds to Windows 9x dial-up, as it doesn't work with null-modem
# out of the box
#
# Usage:
# 1. enable pre-dial terminal
# 2. login and exec into it
# 3. continue dialling
@torcado194
torcado194 / cleanEdge-shadertoy.glsl
Last active May 4, 2024 03:10
cleanEdge, a pixel art upscaling algorithm for clean rotations
/*** MIT LICENSE
Copyright (c) 2022 torcado
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
@Fluepke
Fluepke / log_train.sh
Created November 12, 2022 15:16
Log train rides on german trains (location data, internet availability, speed, etc.)
#!/bin/bash
if ! command -v curl &> /dev/null; then
echo "This script needs curl. Please install curl."
exit -1
fi
if ! command -v jq &> /dev/null; then
echo "This script needs jq. Please install jq."
exit -1
@mattdesl
mattdesl / cli.js
Created September 13, 2022 10:37
colour palette from text prompt using Stable Diffusion https://twitter.com/mattdesl/status/1569457645182152705
/**
* General-purpose NodeJS CLI/API wrapping the Stable-Diffusion python scripts.
*
* Note that this uses an older fork of stable-diffusion
* with the 'txt2img.py' script, and that script was modified to
* support the --outfile command.
*/
var { spawn, exec } = require("child_process");
var path = require("path");
import os
import sys
"""
This (pure!) python script streams a YUV4MPEG format video to stdout. It easily
runs at 1080p60fps on my machine.
Pipe it into a media player like this:
python3 swar_life.py | mpv -
@tylermorganwall
tylermorganwall / submarine_cable_map.R
Last active April 19, 2024 07:36
Submarine Cable Map Dataviz
library(geojsonsf)
library(sf)
library(rayrender)
#Data source: https://github.com/telegeography/www.submarinecablemap.com
cables = geojson_sf("cable-geo.json")
cablescene = list()
counter = 1
for(i in 1:length(cables$geometry)) {
# based on https://github.com/amber-sixel/PythonCatPrinter.git
# can be used as a raw postscript printer (a4, one page only) on port 9100
#
# status : curl --location --request GET 'localhost:5000'
#
# curl --location --request POST 'localhost:5000' \
# --form 'image=@"/image.jpg"' \ #optional
# --form 'text="hello world"' \ #optional
# --form 'size="48"' \ #optional
@gdestuynder
gdestuynder / sudoro
Last active February 23, 2017 08:16
safety first!
#!/bin/bash
# What's this?!
# Just a POC, so there might be caveats I did not think of. It gives you a root user with read-only filesystem access
# Uses a new, non-persistent filesystem namespace in order not to pollute the system's mounts (disappears when the command exists and is not seen by other processes)
# Example:
# kang$ sudoro
# root# touch /boot/aaa
# touch: cannot touch '/boot/aaa': Read-only file system
@Rich-Harris
Rich-Harris / service-workers.md
Last active April 21, 2024 16:24
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@xndc
xndc / tunejack.sh
Last active March 10, 2024 16:42
Instant radio streaming script using the TuneIn API
#!/bin/bash
# tunejack.sh uses the TuneIn public API (at opml.radiotime.com) to search for
# a radio station, print out its details and try to play it somehow.
if [ "$#" -eq 0 ]; then
echo "$0: search for a radio station using the TuneIn API"
echo "Usage: $0 PATTERN"
exit 1
fi