Skip to content

Instantly share code, notes, and snippets.


Ahmed Fasih fasiha

View GitHub Profile
fasiha /
Last active Feb 27, 2021
iTerm2, Karabiner Elements, and Hammerspoon for new Mac


Setup for


First, install all three tools above. (Or just iTerm2 if you don't care about keyboard speedups; or just Karabiner Elements & Hammerspoon if you don't care about iTerm2).

Then clone this repository to your local computer: run this in Terminal:

fasiha /
Last active Feb 12, 2021
One of my favorite sections of Aaron Brown's "Financial risk management for dummies", chapter 4, on the three ways to look at markets

Looking at Financial Markets

Academics who study finance but don’t actually work in the field have developed two main views of financial markets:

  • Information aggregation: Economists tend to treat financial markets as mechanisms for evaluating information and using it to set prices, which in turn regulate economic activity.
  • Random walk: Finance professors tend to treat markets as random walks. In a random walk, future price movements don’t depend on past movements. The metaphor is a drunk person taking each step in a randomly chosen direction, as opposed to a sober person whose steps can be predicted by the path she’s on. Of course, these finance professors don’t deny that markets process information and set prices, but if today’s price incorporates everything known today, then the move to tomorrow’s price must be unpredictable, or random.

A third view of financial markets is seldom taught in universities, at least not in economics departments and business schools. This third view holds that financial


Antirez, creator of Redis, excellent C programmer and API designer, tweeted this: (the thread goes both up and down from this link, it'd be helpful to scroll up then read)

He says (paraphrasing) that

(0) while programming is many things to many people,

(1) to him, part of programming is being able to implement a bubble sort or selection sort (slow, quadratic algorithms that are rarely seen outside beginner courses) under pressure—in an interview or on the job,

fasiha / combinatorics.ts
Created Oct 30, 2020
JavaScript/TypeScript basic combinatorics generators/iterators—because I always forget how these work
View combinatorics.ts
function* range(start: number, end: number) {
for (; start <= end; ++start) { yield start; }
function last<T>(arr: T[]) { return arr[arr.length - 1]; }
export function* numericCombinations(n: number, r: number, loc: number[] = []): IterableIterator<number[]> {
const idx = loc.length;
if (idx === r) {
yield loc;
fasiha /
Last active Sep 27, 2020
Express.js and PouchDB-Server: demo for multi-database Express-controlled "auth" with URL-rewriting

Introduction via Stack Overflow question & answer


git clone THIS_GIST_URL pouch-demo
cd pouch-demo
mkdir databases
npm install
node server.js
fasiha / 1.txt
Created Sep 6, 2020
Ebieki 🦐🚉 path through Wanikani vocabulary
View 1.txt
## Path through radicals for vocabulary: one kanji/radical per lesson
一: Already known 一
日: Already known 日
十: Already known 十
目: Already known 目
田: Already known 田
中: Already known 中
口: Already known 口
人: Already known 人
二: Already known 二
for f in $@; do
d=`exiftool -dateFormat "%Y-%m-%d %H.%M.%S" -CreateDate "$f" | tail -n1 | cut -d: -f2- | sed 's/^ //'`;
b=$(basename "$f");
echo $final;
mv "$f" "$final"
fasiha /
Created May 19, 2020
Curtiz NLP Annotation
  • @ もっとかっこう使つかったほうがいいよ
    • Particles
    • Conjugated phrases
      • 使った | 使つかう + た
    • Vocab
      • もっと | 「もっと」| ① (some) more/even more/longer/further
      • 格好 | 格好・恰好「かっこう・かっこ・カッコ」| ① shape/form/figure/posture/pose ② appearance ③ state/situation ④ suitable/fit/reasonable ⑤ about
fasiha / onyomi-frequency.txt
Created May 7, 2020
Frequencies of Japanese onyomi (on'yomi 音読み) in KANJIDIC2 ( Generated via `grep ja_on kanjidic2.xml | grep '<reading' | sed 's:<[^>]*>::g' | sort | uniq -c| sort -r`: the higher an onyomi appears on this list, the more kanji it's associated with. Potentially helpful e.g., when creating mnemo…
View onyomi-frequency.txt
652 コウ
515 ショウ
375 ソウ
373 キョウ
371 トウ
364 シ
353 カン
343 セン
331 キ
311 ケン
fasiha /
Created Apr 25, 2020
Gloss from JAZEE MINOR's rap in Cream's cover of RGTO


  • @ しゅういちにちサロレベルガンマせん
    • Vocab
      • 週一日 | 週一日「しゅういちにち」| ① one day a week
        • 週 | 週「しゅう」| ① week
        • 一日 | 一日・1日「いちにち・いちじつ・ひとひ・ひとえ」| ① one day ② first day of the month (👉 ついたち,1)
          • 一 | 一・1・壱・弌・壹「いち」| ① one (👉 ワン,1) ② best ③ first/foremost ④ beginning/start ⑤ ace (playing card) (👉 エース) ⑥ bottom string (on a shamisen, etc.)
          • 日 | 日「にち」| ① Sunday (👉 日曜) (abbreviation) ② day (of the month) ③ counter for days ④ Japan (👉 日本) (abbreviation)