Skip to content

Instantly share code, notes, and snippets.

View fasiha's full-sized avatar
💭
🐦‍🔥

Ahmed Fasih fasiha

💭
🐦‍🔥
View GitHub Profile
@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

@fasiha
fasiha / on-mim.md
Last active September 21, 2025 06:03
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
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 / youtube-dl-crunchyroll.md
Last active August 16, 2025 14:44
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 / 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.)

The Indigenous Critique is a term popularized by Graeber and Wengrow’s The Dawn of Everything and it will blow your mind if you, like me, were raised in a Eurocentric universe.

In a nutshell, through the 1600s and 1700s, trenchant critiques of European society by numerous Indigenous statesmen and orators in North America were carried back to Europe, where they caused a sensation. To many Indigenous nations, the European way of life—rapacious, uncharitable, servile—was incomprehensible and obviously inferior to those Indigenous societies where starving people were invariably fed and adopted into family networks, and where no leader could tell a free human what to do let alone some military captain or priest. We have multiple independent examples of this and an oration by Kandiaronk, a famous Wendat statesman, has come down to us, and it is utterly brilliant: Barbara Mann titled her chapter translation, “‘Are you delusional?’ Kandiaronk on Christianity“ (more below).

The reason this Indigenous Critique is c

@fasiha
fasiha / Makefile
Last active June 21, 2025 06:08
A pandoc custom writer targeting tufte-css HTML
test.html: test.md tufte-css.lua html5.html
pandoc -t tufte-css.lua -f markdown -c tufte.css --template html5.html test.md > test.html
html5.html:
pandoc -D html5 > html5.html
@fasiha
fasiha / DictionaryOfJapaneseGrammar.csv
Created December 15, 2017 04:39
All example sentences from Seiichi Makino and Michio Tsutsui's series of three Japanese grammar dictionaries: "Dictionary of Basic Japanese Grammar", "Intermediate" and "Advanced
We can't make this file beautiful and searchable because it's too large.
Number,Expression,Translation,Reading,Grammar Japanese,Grammar English,Grammar Explanation,Notes,Picture,Page,Level,Scrambled
1,私は良子に花をあげた・あげました。,I gave Yoshiko flowers.,私[わたし]は 良子[りょうこ]に 花[はな]をあげた・あげました。,あげる,,give |&nbsp;Someone gives something to a person who is not a member of the giver’s in group but whose status is about equal to that of the giver.,,,63,Basic,
2,大野さんは山本さんに本をあげた。,Ms. Ono gave Mr. Yamamoto a book.,大野[おおの]さんは 山本[やまもと]さんに 本[ほん]をあげた。,あげる,,give |&nbsp;Someone gives something to a person who is not a member of the giver’s in group but whose status is about equal to that of the giver.,,,63,Basic,scrambled
3,君はアンに何をあげましたか。,What did you give to Ann?,君[きみ]はアンに 何[なに]をあげましたか。,あげる,,give |&nbsp;Someone gives something to a person who is not a member of the giver’s in group but whose status is about equal to that of the giver.,,,63,Basic,scrambled
4,私は信男さんにネクタイを買ってあげた・あげました。,I bought a tie for Nobuo.,私[わたし]は 信男[のぶお]さんにネクタイを 買[か]ってあげた・あげました。,あげる,,do s.t. for s.o.; do s.o. a favor by doing s.t.&nbsp;|&nbs