Skip to content

Instantly share code, notes, and snippets.

@Tangent128
Tangent128 / example.js
Last active August 29, 2015 14:09
Async jQuery loader + script dependency resolver. Including this will asynchronously load jQuery, and allow other scripts to register functions to be called once jQuery is available. Importantly, you can safely use the "async" attribute when referencing this script. Dependency resolution is handled by passing the loaded functions an on-demand ge…
// each file needs to start with this to make sure the async array/object exists:
var async = async || [];
// these blocks could be in any order or different files:
async.push(function($, loaded) {
// loaded(name) returns a $.Deferred object, which modules can wait on or resolve as appropriate.
loaded("C").then(function(C) {
console.log("loaded A, needed "+C);
loaded("A").resolve("apple");
});
@Tangent128
Tangent128 / menu.sh
Created November 23, 2014 19:41
Manage dtach sessions via a simplistic menu. (dtach is like screen, but much simpler for the 90% use case.)
#!/bin/sh
# Provides a listing of your ~/.dtach folder to
# remind you what sessions exist; enter the name
# of a session (sans .dtach suffix) to reconnect,
# or a new name to start a new session.
# If an executable exists in ~/.dtach with the same
# name as the session plus an .auto suffix, it will
# be run instead of the shell.
@Tangent128
Tangent128 / gist:c2809bb0539cd3417ed2
Created December 13, 2014 19:23
Xbox 360 controller LED control codes
echo $CODE > /sys/class/leds/xpad*/brightness
(codes 2-5, 11, and 13 ignore other codes until blinking done, but they will immediately apply the most recent code once the blinking's done)
0: off
1: blink all, then light the default light
2: blink #1 a moment, then set #1 and make #1 default
3: blink #2 a moment, then set #2 and make #2 default
@Tangent128
Tangent128 / dumpregistry.lua
Created April 26, 2015 04:07
List of keys used in registry metatables & the SDL module when Lua-SDL2 is loaded
-- pipe the output of this to sort
local SDL = require "SDL"
local registry = debug.getregistry()
local function scanMt(name, mt)
for k, v in pairs(mt) do
if not k:match("^__") then
print(name, k)
#!/bin/sh
test "$OUTRES" || OUTRES=672x420
test "$URL" || URL="icecast://source:hackme@hostname.tld:port/index.webm"
CODECS="-acodec libvorbis -vcodec libvpx -threads 3 -deadline realtime -cpu-used 4 -g 20 -vb 700k -bufsize 700k"
FILTER="-s $OUTRES"
@Tangent128
Tangent128 / lets-encrypt-nginx.sh
Created March 18, 2018 04:21
Let's Encrypt metaautomation to setup acme.sh for appropriate servers
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 subdomain.domain.tld"
exit 1
fi
/root/acme/acme.sh --issue -d "$1" --stateless
/root/acme/acme.sh --install-cert -d "$1" \
@Tangent128
Tangent128 / ffleft.sh
Created March 23, 2020 00:39
webmetro streaming scripts
#!/bin/sh
FPS=30
INRES=1680x1050
test "$OUTRES" || OUTRES=672x420
# if this needs to be fixed, you can use `ffmpeg -sources pulse` to list candidates
AUDIO_DEVICE=alsa_output.pci-0000_0b_00.3.analog-stereo.monitor
AUDIO_IN="-thread_queue_size 1024 -f pulse -channels 2 -i $AUDIO_DEVICE"