Skip to content

Instantly share code, notes, and snippets.

View alpgul's full-sized avatar

Alptekin Gülcan alpgul

View GitHub Profile
@alpgul
alpgul / ffmpeg_tuts.md
Created August 3, 2021 15:31 — forked from tingplenting/ffmpeg_tuts.md
ffmpeg cli for youtube

Extract audio from a YouTube video file

ffmpeg -i INPUT.mp4 -ab 256k OUTPUT.mp3

Cut 3s length

ffmpeg -y -ss 00:00:03 -i INPUT.mp4 -codec copy OUTPUT.mp4
@alpgul
alpgul / mutexes.ts
Created February 11, 2024 19:20 — forked from GavinRay97/mutexes.ts
TypeScript Node.js/Browser Mutex + Read-Write Mutex using Atomics
class AsyncLock {
private _lock = new Int32Array(new SharedArrayBuffer(4)) // SharedArrayBuffer for multi-threading, 4 bytes for 32-bit integer
static INDEX = 0
static UNLOCKED = 0
static LOCKED = 1
lock() {
while (true) {
console.log("lock")