Skip to content

Instantly share code, notes, and snippets.

View farshed's full-sized avatar
🦀
Just following my world line

Faisal Arshed farshed

🦀
Just following my world line
View GitHub Profile
@farshed
farshed / wav-worker.js
Created February 1, 2025 00:50
Worker for encoding raw PCM audio to WAV
self.onmessage = function (e) {
var wavPCM = new WavePCM(e['data']['config']);
wavPCM.record(e['data']['pcmArrays']);
wavPCM.requestData();
};
var WavePCM = function (config) {
this.sampleRate = config['sampleRate'] || 48000;
this.bitDepth = config['bitDepth'] || 16;
this.recordedBuffers = [];
@farshed
farshed / ts-server.js
Last active January 15, 2025 11:05
Minimal localhost file server with TS support
const http = require('http');
const subproc = require('child_process');
const serveStatic = require('serve-static');
let compilelock = false;
const server = http.createServer((req, res) => {
if (!compilelock && req.url?.includes('.js')) {
compilelock = true;
compileTS()
@farshed
farshed / ytdl_playlist.sh
Last active September 27, 2021 09:05
Install youtube-dl from https://github.com/ytdl-org/youtube-dl#installation, replace <PLAYLIST_ID> with your playlist's id and run.
youtube-dl -ciw --playlist-start 1 -o "%(playlist_index)s-%(title)s.%(ext)s" 'https://www.youtube.com/playlist?list=<PLAYLIST_ID>'
@farshed
farshed / Kotlin.sublime-build
Last active July 20, 2020 08:58
Sublime Text 3 build system config to compile and run Kotlin programs
{
"cmd": ["kotlinc $file -include-runtime -d $file_base_name.jar && java -jar $file_base_name.jar"],
"selector": "source.kotlin",
"file_patterns": ["*.kt"],
"shell": true
}