Skip to content

Instantly share code, notes, and snippets.

@sgentle
sgentle / launchoptionsmac.md
Created August 2, 2026 23:25
Setting environment variables and injecting libraries using Steam launch options on Mac

A working launch options example from me messing around with RED4ext on Cyberpunk for Mac:

/bin/sh -c "open --env DYLD_INSERT_LIBRARIES=\"$STEAM_DYLD_INSERT_LIBRARIES:@executable_path/../../../red4ext/RED4ext.dylib:@executable_path/../../../red4ext/FridaGadget.dylib\" --env DYLD_FORCE_FLAT_NAMESPACE=1 -nW %command% --args -fullscreen"

Which is roughly equivalent to what you would expect from writing: DYLD_INSERT_LIBRARIES=red4ext/RED4ext.dylib:red4ext/FridaGadget.dylib %command% -fullscreen (which definitely does not work)

Here's a breakdown of all the incantations:

  • The first argument has to be a full path to an executable, so we use /bin/sh and pass everything else as one big string with -c
  • %command% is automatically enclosed in single quotes ('), so the string we pass to -c has to be in double quotes ("), and any double quotes inside it have to be escaped (\")
const TOKENS = {
id: /[a-z]+/,
num: /(?:[0-9]+\.)?[0-9]+/,
op: /[+-/*]/,
leftparen: /\(/,
rightparen: /\)/,
error: /./
}
function* tokenize(str, tokens) {
<script>
const url = 'chrome-devtools://devtools/bundled/inspector.html?nodeFrontend=true'
fetch(`http://localhost:${location.search.slice(1)}/json`)
.then(res => res.json())
.then(results => results.find(x => x.url == location).webSocketDebuggerUrl)
.then(wsurl => ({then: addEventListener.bind(new WebSocket(wsurl), 'open')}))
.then(ev => ev.target.send(JSON.stringify({
method: 'Page.navigate',
id: 0,
params: {url}
@sgentle
sgentle / gist:7a550550e0a7b220a5e6
Created February 27, 2016 17:43
Beyoncé numbers
22
10213223
10311233
10313314
10313315
10313316
10313317
10313318
10313319
21322314
@sgentle
sgentle / gist:58e3e37c28a7662d014f
Created April 26, 2015 10:08
Audio loops in CoffeeScript with fetch and Promises
ctx = new (AudioContext || webkitAudioContext)
addAudio = (src) ->
fetch src
.then (response) -> response.arrayBuffer()
.then (audioData) -> new Promise (accept) -> ctx.decodeAudioData audioData, accept
.then (buffer) ->
node = ctx.createBufferSource()
node.buffer = buffer
node.loop = true
node.connect ctx.destination
<div autofocus></div>
<script>
navigator.webkitGetUserMedia({audio: true}, function(){}, function(){});
window.onresize = function() {
requestAnimationFrame(function() {
document.body.style.backgroundColor = "red";
});
window.onresize = function(){};
};

Keybase proof

I hereby claim:

  • I am sgentle on github.
  • I am sgentle (https://keybase.io/sgentle) on keybase.
  • I have a public key whose fingerprint is DE22 29B5 2F68 37CA 370C 85B4 29CA 85AE 3B87 C23B

To claim this, I am signing this object:

#!/bin/bash
QUALITY=${2:-bestvideo}
if [[ $1 == "http"* ]]; then
URL=`youtube-dl -f $QUALITY -g $1`;
else
URL=$1
fi
open -na /Applications/VLC.app "$URL" --args --loop --no-osd --no-macosx-nativefullscreenmode --video-wallpaper
echo 'tell application "VLC" to close every window' | osascript
or#orCorroreoraortoreorsor oraornor oroorborjoreorcortor orworhoroorsoreor orkoreoryorsor oraorroreor ortorhoreor oraorrorgoruormoreornortorsor
orSoreortor or=or or(oraorrorgorsor.or.or.or)or or-or>or
or or oreorloreormorsor or=or oriorfor oraorrorgorsor[or0or]or.orcoroornorsortorroruorcortoroorror.ornoraormoreor or=or=or or"orAorrorroraoryor"or ortorhoreornor oraorrorgorsor[or0or]or oreorlorsoreor oraorrorgorsor
or
or or or@or[oreorloreormor]or or=or ortorroruoreor orforoorror oreorloreormor oriornor oreorloreormorsor
or or or or or
or or orroreortoruorrornor or@or
or
preloads = $('img.preload')
preloads.load(_.barrier(preloads.length, function() { alert("all images loaded!"); }));