Skip to content

Instantly share code, notes, and snippets.

💭
🧘‍♂️

Ahmed Fasih fasiha

💭
🧘‍♂️
Block or report user

Report or block fasiha

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View halfwidth-fullwidth-small-katakana.txt
アアァ
イイィ
ウウゥ
エエェ
オオォ
カカ
キキ
クク
ケケ
ココ
@fasiha
fasiha / frequencies.json
Created Oct 18, 2019
Mecab-IPADIC "-O yomi" output of a bunch of Japanese subtitle files, and associated character frequencies (kanji that MeCab couldn't understand deleted). I can't figure out how to get "yomi"-style output out of UNIDIC.
View frequencies.json
[
["\n",300426],
[" ",158830],
["!",638],
["(",2022],
[")",2023],
[",",136462],
["-",136708],
["0",421613],
["1",193907],
@fasiha
fasiha / Fsympad.py
Created Aug 29, 2019
How to zero-pad nicely symmetric vectors for FFT, so FFT of real symmetric inputs is (to machine precision) real
View Fsympad.py
def Fsympad(h, m=None, inputOriginMiddle=True):
if inputOriginMiddle:
h = fft.ifftshift(np.array(h))
else:
h = np.array(h)
if not m:
return fft.fftshift(fft.fft(h))
n = h.size
assert m >= n
# odd-length case: just insert zeros
View index.html
<meta charset="UTF-8">
<script src="plotly-1.48.1.min.js"></script>
<p>
Source: <a href="https://www1.ncdc.noaa.gov/pub/data/ghcn/daily/by_year/"><code>ghcn/daily/by_year</code></a>.
Background: <a href="https://www.ncdc.noaa.gov/ghcn-daily-description">Global Historical Climate Network Daily -
Description</a>.
</p>
<div id="tester" style="width:100%;height:90%;"></div>
<script>
const yearlyRaw = `1763,3379.2,730
@fasiha
fasiha / money.md
Created May 9, 2019
Excerpt from Aaron Brown’s “Red-Blooded Risk: The Secret History of Wall Street” (chapter 10) on gold money, paper money, and derivatives
View money.md

To start a business with precious metal money, you need to have or to find an investor with enough precious metal to buy all the assets you need to start generating cash sales. To start a business with paper money, you need to find a bank willing to supply you with pieces of paper. Neither you nor the bank need have any net worth, although in practice banks tend to maintain net worth equal to a fraction of the loans they make. Even so, the amount of capital required to start the business with paper money lent by a bank is much less than the total value of the assets required. What is essential is that the bank’s lending standards are low enough to approve your loan, but high enough to make its paper money acceptable enough to acquire the assets you need.

To start a business with derivative money, you identify all assets you require and all products you will deliver in the future. Of course, there is uncertainty around these things, especially the amount and quality of products you will deliver. You don’t hav

View gist:53797924cafb5dbca69eeadcebe76312
# Put new words in a CSV with this format
# 表層形,左文脈ID,右文脈ID,コスト,品詞,品詞細分類1,品詞細分類2,品詞細分類3,活用形,活用型,原形,読み,発音
# surface_form,left_context_id,right_context_id,cost,part_of_speech,pos_division_1,pos_division_2,pos_division_3,inflection_type,inflection_style,lemma,reading,pronunciation
$ echo "fasihsignal,-1,-1,100,名詞,一般,*,*,*,*,fasihsignal,ファシシグナル,ファシシグナル" > a.csv
# Then use mecab-dict-index to compile the csv into a .dic file, based on an existing mecab dictionary file
$ /usr/local/Cellar/mecab/0.996/libexec/mecab/mecab-dict-index -d/usr/local/Cellar/mecab/0.996/lib/mecab/dic/ipadic/ -u a.dic -f utf8 -t utf8 a.csv
# The use it
$ mecab -ua.dic
@fasiha
fasiha / brown.md
Last active Apr 27, 2019
Aaron Brown on risk and sleep deprivation
View brown.md

Aaron Brown, on Chat with Traders episode 149, on risk and sleep deprivation.

The other half of risk. In poker at first you can just play quantitatively. You know the numbers, you know the probabilities. At low levels you collected money just by probability. But as you get higher and higher and you start to get some of the best players in the country, you realize there’s a whole other level you gotta get and it’s all done by your unconscious brain. You can’t calculate it, you gotta feel it, and you gotta train your unconscious brain to play poker. It’s a powerful computer up there … but it doesn’t know how to play poker. And your conscious brain is very weak, can’t multiply two three digit numbers together which a computer can do easily. So your conscious brain is relegated tasks like coming up with advertising jingles and wondering which celebrity marriages are in trouble while your unconscious brain handles heartbeat and respiration and whether you’

@fasiha
fasiha / holdem.md
Last active Feb 3, 2019
Several four-player hands of hold ’em via https://github.com/fasiha/hold-em-tools
View holdem.md

1

Player 1

Percents rf sf qu fh fl st tr 2p pa hi
9c10c = hi <1 <1 <1 2 6 9 4 22 41 16
10c 9c× 5h Kc 6d = hi 0×0 <1×<1 0×<1 0×2 4×<1 3×5 1×4 8×21 47×47 36×21
10c 9c× 5h Kc 6d 6s = pa 0×0 0×0 0×<1 0×6 0×0 0×2 4×9 26×42 70×42 0×0
10c 9c× 5h Kc 6d 6s Jc = pa ×0 ×0 ×<1 ×3 ×0 ×0 ×7 ×39 ×52 ×0
@fasiha
fasiha / Ebisu-Java-Bare.ipynb
Created Nov 11, 2018
Very barebones Java implementation of Ebisu https://fasiha.github.io/ebisu/
View Ebisu-Java-Bare.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.