Skip to content

Instantly share code, notes, and snippets.

View takegue's full-sized avatar
🏠
Working from home

takegue takegue

🏠
Working from home
View GitHub Profile
@qnighy
qnighy / rust-patterns.md
Last active March 20, 2024 03:33
Rustのパターンっぽいやつメモ

パターンとはその言語が抽象化できなかった敗北の歴史である。 しかしどんなに優れた言語であってもあらゆる繰り返しに勝てるわけではない。 人は必ずメタ繰り返しを欲するからだ。 そしてそれはRustも例外ではない。

ここでは、OOPでも知られているパターンよりも、Rustに特有のパターンを思いつく限りまとめてみた。名前は適当。

  • crate splitting
    • でかいcrateを分割して、見通しを良くする・再コンパイルの分量を削減する・並列コンパイルを可能にする
  • 親玉crate(全てにdependする)と殿crate(全てにdependされる)があることが多いので、だいたい束みたいな形になる。
@sile
sile / 0_succ_bp.md
Last active July 17, 2023 23:57
簡潔データ構造やBalancedParenthesesの紹介資料メモ

発表資料メモ: 簡潔データ構造について

  1. 主題

  • 数千万オーダーの文字列集合(およびマップ)を如何にサイズ効率良く表現するか、の話
    • 諸事情で集合をメモリ上に保持したいことがあるが、サイズは節約したい
    • 実際にはサイズのみを追求するのではなく、諸々のトレードオフを加味しつつバランスを取る
  • 今回はそれを実現するための方法の一つである 簡潔データ構造 について説明する:
@neubig
neubig / lstm-lm.py
Last active August 23, 2017 09:18
This is a minimal implementation of training for a language model using long short-term memory (LSTM) neural networks
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is a simplified implementation of the LSTM language model (by Graham Neubig)
#
# LSTM Neural Networks for Language Modeling
# Martin Sundermeyer, Ralf Schlüter, Hermann Ney
# InterSpeech 2012
#
# The structure of the model is extremely simple. At every time step we
@ikegami-yukino
ikegami-yukino / nfkc_compare.txt
Created December 30, 2013 19:32
Pythonのunicodedata.normalize('NFKC')で正規化される文字の一覧
# -*- coding: utf-8 -*-
import unicodedata
for unicode_id in xrange(65536):
char = unichr(unicode_id)
normalized_char = unicodedata.normalize('NFKC', char)
if char != normalized_char:
if len(normalized_char) == 1:
print u'[%d] %s -> [%d] %s' % (unicode_id, char, ord(normalized_char), normalized_char)
else:
@jpouellet
jpouellet / zbell.sh
Last active November 24, 2023 10:49
Makes Zsh print a bell when long-running commands finish. I use this in combination with i3 and throw big compile jobs (or whatever it may be) into another workspace to get a nice visual notification (workspace indicator turns red) when it's done so I don't need to waste time regularly checking on it.
#!/usr/bin/env zsh
# This script prints a bell character when a command finishes
# if it has been running for longer than $zbell_duration seconds.
# If there are programs that you know run long that you don't
# want to bell after, then add them to $zbell_ignore.
#
# This script uses only zsh builtins so its fast, there's no needless
# forking, and its only dependency is zsh and its standard modules
#
@jboner
jboner / latency.txt
Last active May 6, 2024 07:06
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD