Skip to content

Instantly share code, notes, and snippets.

View fasiha's full-sized avatar
💭
🌇

Ahmed Fasih fasiha

💭
🌇
View GitHub Profile
@fasiha
fasiha / claude-session-to-md.js
Last active July 19, 2026 21:12
Given a UUID, find the Claude Code session and convert to a Markdown
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const readline = require('readline');
async function findJsonlFile(uuid) {
const projectsDir = path.expandUser('~/.claude/projects');
function searchDir(dir) {
@fasiha
fasiha / czt.m
Created July 1, 2015 19:18
Using CZT for zoom-FFT and zoom-IFFT in Matlab/Octave
% Copyright (C) 2004 Daniel Gunyan
%
% This program is free software; you can redistribute it and/or modify it under
% the terms of the GNU General Public License as published by the Free Software
% Foundation; either version 3 of the License, or (at your option) any later
% version.
%
% This program is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
@fasiha
fasiha / rotateVectors.py
Last active April 7, 2026 14:22
I frequently have to re-implement projecting vectors onto other vectors, and rotating vectors about other vectors. So here we go. Public domain.
import unittest
import numpy as np
import numpy.linalg as linalg
def makeUnit(x):
"""Normalize entire input to norm 1. Not what you want for 2D arrays!"""
return x / linalg.norm(x)
@fasiha
fasiha / on-mim.md
Last active March 13, 2026 05:58
A list of all onomatopoeic or mimetic word in JMDict (as of 2025-09-15) onomatopoeia
  1. 「あっさり・アッサリ」| ① easily/readily/quickly/flatly (refuse) ② lightly (seasoned food, applied make-up, etc.)/plainly/simply
  2. 「あべこべ」| ① contrary/opposite/inverse/reverse/back-to-front
  3. 「あやふや」| ① uncertain/indefinite/vague/ambiguous/equivocal/dubious/doubtful/non-committal
  4. 「イジイジ・いじいじ」| ① hesitantly/timidly/diffidently
  5. 「いそいそ・イソイソ」| ① cheerfully/joyously/joyfully/happily/lightheartedly/excitedly/eagerly
  6. 「イチャイチャ・いちゃいちゃ」| ① making out/necking/getting handsy/canoodling/being lovey-dovey/getting affectionate (with each other)/romantic play/fondling
  7. 「うじうじ・ウジウジ」| ① indecisively/hesitantly/irresolutely/wishy-washily
  8. 「うじゃうじゃ・ウジャウジャ」| ① in swarms/in clusters ② tediously/slowly
  9. 「うずうず・ウズウズ」| ① itching to do something/impatient/sorely tempted/eager
  10. 「うぞうぞ」| ① irrepressibly aroused (esp. sexually)/stimulated
@fasiha
fasiha / youtube-dl-crunchyroll.md
Last active February 22, 2026 23:04
Youtube-dl with Crunchyroll

Get the following:

  • a Crunchyroll account (though they let you watch/download some videos without an account, at 480p),
  • the latest youtube-dl (brew upgrade youtube-dl),
  • your browser’s user agent,
  • your Crunchyroll cookies (cookie.txt export for Chrome is handy) into a cookies.txt file.

Then,

@fasiha
fasiha / rgama.c
Created April 13, 2017 04:10
C code from Marsaglia & Tsang’s “A simple method for generating gamma variables” (2000), with typos corrected http://dl.acm.org/citation.cfm?doid=358407.358414
#include <math.h>
extern float RNOR; // Normal random variable
extern float UNI; // Uniform random variable
float rgama(float a) {
float d, c, x, v, u;
d = a - 1. / 3.;
c = 1. / sqrt(9. * d);
for (;;) {
@fasiha
fasiha / README.md
Last active December 24, 2025 15:51
Set up RTL-SDR, dump1090, and dump978 for ADS-B/TIS-B/FIS-B/UAT on macOS

Introduction

I’m not very familiar with the aviation jargon (see FAA’s ADS-B FAQ), but ADS-B is a next-gen system where aircraft are equipped with transponders that periodically broadcast their own positions and receive the reports from both other aircraft (direct air-to-air) as well as air-traffic control (ATC) ground transmitters.

There are two separate ADS-B radio bands: the commercial aviation (CA) is at 1090 MHz while the general aviation (GA) is at 978 MHz. If I can be permitted a gross generalization—the former corresponds to big commercial jets and the latter to small private aircraft.

Because ADS-B is designed to democratize airspace situational awareness (in contrast to the older setup, like from films, where a central air-traffic controller is coordinating all these aircraft that can’t see each other), we can buy cheap RF receivers to pick up and decode the messages being broadcast by aircraft and ground towers to get our own picture of the

Emoji en fr es zh ja ar id
🏟 stadium stade estadio guǎn きょうじょう إِسْتادِ stadion
🏛 classical building monument classique edificio clásico diǎnjiànzhù れきてきたてもの مَبْنَى أَثَرَيَّ bangunan klasik
🏗 building construction construction d’un bâtiment construcción shīgōng けんせつちゅう إِنْشاءاتٍ konstruksi bangunan
🧱 brick brique ladrillo zhuān れんが طَوَّبَهُ batu bata
🪨 rock rocher piedra 岩yán<
@fasiha
fasiha / posdef.py
Last active August 2, 2025 11:17
Python/Numpy port of John D’Errico’s implementation (https://www.mathworks.com/matlabcentral/fileexchange/42885-nearestspd) of Higham’s 1988 paper (https://doi.org/10.1016/0024-3795(88)90223-6), including a built-in unit test. License: whatever D’Errico’s license, since this is a port of that.
from numpy import linalg as la
import numpy as np
def nearestPD(A):
"""Find the nearest positive-definite matrix to input
A Python/Numpy port of John D'Errico's `nearestSPD` MATLAB code [1], which
credits [2].
@fasiha
fasiha / overlapSave.py
Created May 15, 2018 01:56
A quick code tutorial on overlap-save vs single giant IFFT/FFT vs numpy.convolve to achieve linear convolution.
"""
Overlap-save approach to fast-convolution.
This script shows how to use
- one long FFT,
- several short FFTs (overlap-save, or overlap-discard),
- and `numpy.convolve`
to achieve the same end: linear convolution. (I don't like overlap-add so that's not included.)