Skip to content

Instantly share code, notes, and snippets.

View fasiha's full-sized avatar
💭
🧘‍♂️🐻

Ahmed Fasih fasiha

💭
🧘‍♂️🐻
View GitHub Profile
@fasiha
fasiha / horimiya.csv
Last active August 23, 2023 04:46
Onomatopoeia in Horimiya (Yen Press, Taylor Engel (translator) and Alexis Eckerman (letterer)). See https://octodon.social/@22/110658625756122629
Volume Page Kana Transcript Translation Note See also JMDict
1 7 ハンッ Han clap hands
7 カリ kari scrit pencil on paper
8 ほすん posun paff placing eraser in someone’s hand
8 とぼ tobo plod walking steps とぼとぼ
9 パァァ paaaa beam smile
10 バンッ ban wham door closing ? バンバン
10 きゅ kyu clip hair clip closing きゅっと
10 ザッ za shhk vacuum attachment attaching? ザーザー
10 ズゴゴゴオオオ zupogogoooo vreeeen vacuuming
@fasiha
fasiha / README.md
Last active August 16, 2023 06:56
Understanding overlapping memory transfers and kernel execution for simple CUDA workflows

Understanding overlapping memory transfers and kernel execution for very simple CUDA workflows

Executive summary

This small exploration started when Dr Jon Rogers mentioned that one could get overlapping memory transfer and kernel execution by using device-mapped page-locked host memory (see section 3.2.4, Page-Locked Host Memory, of the CUDA C Programming Guide version 6.0) even for simple CUDA workflows, i.e., copying some data from the host to device, operating on that data on the device, and

@fasiha
fasiha / exif.md
Created August 12, 2023 12:37
Exif and Artwork Content Description example

Circular reasoning

An excerpt from Duncan Watts, Everything Is Obvious: when you know the answer* (2012, chapter 3)

Although it is rarely presented as such, this kind of circular reasoning—X succeeded because X had the attributes of X—pervades commonsense explanations for why some things succeed and others fail. For example, an article on the success of the Harry Potter books explained it this way:

“A Cinderella plot set in a novel type of boarding school peopled by jolly pupils already has a lot going for it. Add in some easy stereotypes illustrating meanness, gluttony, envy, or black-hearted evil to raise the tension, round off with a sound, unchallenging moral statement about the value of courage, friendship, and the power of love, and there already are some of the important ingredients necessary for a match-winning formula.”

In other words, Harry Potter was successful because it had exactly the attributes of Harry Potter, and not something else.

Likewise, when Facebook first became pop

@fasiha
fasiha / no-hackerrank.md
Last active August 7, 2023 11:47
A prospective employer invited me to do a HackerRank test. Here's my proposed alternative.

Well, that was unexpected. In the following, I’m trying to follow Jon Evans’ advice from “The Terrible Technical Interview”.


To: recruitment@EmployerABC.com
From: Ahmed Fasih
Subject: Re: Programming Test Invitation

Hi there! Thanks for offering to let me take a HackerRank test for ABC, I appreciate the vote of confidence.

Single Women Single Men Men/Women (%)
Average annual expenditures $36,061 $38,748 107.5%
Food 4,299 4,871 113.3%
Food at home 2,557 2,447 95.7%
Cereals and bakery products 322 288 89.4%
Cereals and cereal products 89 86 96.6%
Bakery products 233 202 86.7%
Meats, poultry, fish, and eggs 468 528 112.8%
Beef 110 135 122.7%
@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 / binomialExpansion.py
Last active May 24, 2023 05:25
If you ever need to expand a product of binomials like `prod(1 - x for x in lst)`, or its log equivalent, into a sum of monomials, here's a little well-tested Python module for you! This is handier than you'd think when the product of binomials is inside an integral for example.
from itertools import combinations
from typing import Any
from math import prod
def expand(lst: list[Any]):
"""
Expands `prod(1 - x for x in lst)` into a sum of monomials
Returns a list which summed will yield the product of binomials above.
@fasiha
fasiha / EDICT-RTK1-set-cover.md
Last active May 21, 2023 08:37
Approximation to the cover set problem with Remembeing the Kanji volume 1 kanji and compounds in EDICT

Considering all the compounds in EDICT made up solely of kanji from Remembering the Kanji volume 1, there is a smallest subset of compounds that includes the most number of these kanji. Below is a list of 1126 compounds that, together, include 2004 (of RTK1's 2200) kanji. (This general problem is called the set cover problem and this list is the greedy approximation to the solution.)

Source code at https://github.com/fasiha/compounds-per-kanji/tree/set-cover (Javascript).

For completeness, here are the 196 kanji that are in RTK1 but that don't appear as compounds in EDICT:

  • 118 kanji appearing in EDICT as stand-alone kanji (not in compounds): 升肘嘲貝貼頁呪嗅鯉厘宵桂杏桐苛荻辻鍵錦柿曇諦瞳叱匂虹羨誰芯憧捗又股茎峠嵐崎崖翁桁梨謎膝笠笹篭但俺畝丙瓦膳据裾岬剥漕斗溺顎猪渚賭挟頬釜鍋阿窪蓋藍餌坪爽塞椿僅唾琴鎌栗喉勅腫痩杉斑艶狙僕浦嗣舷枕函畏鶴蔦鳩媛遡岡蹴駒罵虎虞麓熊寅辰朕遵丑羞卯巳柴

  • 78 kanji not appearing in EDICT at all: 吾朋昌旭亘貞勺孔汐埼填圭梢沫旺冥詮訃弐幌沃嬌匕諧謁壱茨曽栃椎曰錮咽恣串憬梗隻淫采冶允裳勃傲匁蔽奈斬臼毀廿之智弘捉踪緻怨瑠酉刹璃梓菱亥錘慄楠辣薫瘍彦某恭柵哺蒲

@fasiha
fasiha / meijerGm00m.py
Created May 18, 2023 05:47
Python evaluation of a particular Meijer G function by summing residues: implements the solution in https://math.stackexchange.com/a/4700880
import sympy as s
from sympy import S
isInt = lambda x: x == int(x)
isZeroNegInt = lambda x: x <= 0 and isInt(x)
def meijerGm00m(bs, z, numSeries=20, verbose=False):
"""
An approach to implementing the MeijerG^{m,0}_{0,m} function.