Skip to content

Instantly share code, notes, and snippets.

View terasakisatoshi's full-sized avatar

Satoshi Terasaki terasakisatoshi

View GitHub Profile
@fnielsen
fnielsen / imagenet_label_to_wordnet_synset.txt
Created August 23, 2017 12:44
ImageNet label to wordnet synset identifier
{0: {'id': '01440764-n',
'label': 'tench, Tinca tinca',
'uri': 'http://wordnet-rdf.princeton.edu/wn30/01440764-n'},
1: {'id': '01443537-n',
'label': 'goldfish, Carassius auratus',
'uri': 'http://wordnet-rdf.princeton.edu/wn30/01443537-n'},
2: {'id': '01484850-n',
'label': 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
'uri': 'http://wordnet-rdf.princeton.edu/wn30/01484850-n'},
3: {'id': '01491361-n',
@mbinna
mbinna / effective_modern_cmake.md
Last active July 20, 2025 14:17
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

#!/usr/bin/env sbcl --script
(defconstant n 100)
(defconstant niters #.(expt 10 9))
(defconstant b #.(/ (log (+ 1 (sqrt 2))) 2))
(defun rand_ising2d ()
(declare (optimize (speed 3) (safety 0) (debug 0)))
(let ((a (make-array '(#.n #.n) :element-type '(integer -1 1))))
(dotimes (i n a)
(dotimes (j n)
@tamsanh
tamsanh / jupyter_cell_notify.py
Created April 6, 2018 03:18
Generate and play a sound in Jupyter Notebook when then cell is run. Useful as notification when a long-running cell is done.
from IPython.lib.display import Audio
import numpy as np
framerate = 4410
play_time_seconds = 3
t = np.linspace(0, play_time_seconds, framerate*play_time_seconds)
audio_data = np.sin(2*np.pi*300*t) + np.sin(2*np.pi*240*t)
Audio(audio_data, rate=framerate, autoplay=True)
@d-kuro
d-kuro / git-completion_zsh.md
Last active April 20, 2023 01:25
zsh で git コマンドの補完を有効にする

zsh で git コマンドの補完を有効にする

brew で git をインストールした

$ ls -l `brew --prefix`/share/zsh/site-functions/

_gitgit-completion.bash が表示されていることを確認する。

@nulledge
nulledge / MPI-INF-3DHP.ipynb
Created October 29, 2018 07:49
MPI-INF-3DHP
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lyakaap
lyakaap / debug.py
Created November 3, 2018 07:02
For debugging at the point exception raised without modifying scripts
import sys
import traceback
import pdb
"""
This module is for debugging without modifying scripts.
By just adding `import debug` to a script which you want to debug,
automatically pdb debugger starts at the point exception raised.
"""
@LambdaNote
LambdaNote / writing.md
Last active May 18, 2025 16:18
ラムダノートでの原稿の書き方

ラムダノートでの原稿の書き方

記事の執筆には、Markdown形式を利用してください。 Markdownにはさまざまな流派がありますが、GitHub Flavored Markdown(https://github.github.com/gfm/ )をベースとした書式を採用します。

書籍を執筆するための形式として考えると、Markdownには不足している機能が多々あります。 しかし、次のような利点があるので、Markdownを採用することにします。

  • 最低限の構造しかないので、見た目でごまかせる余地が少ない
  • 原稿を著者自身が再利用してもらいやすくしたい
.ipynb_checkpoints/
@rtaori
rtaori / idx_to_wnid.sh
Created March 18, 2019 08:02
Convert an Imagenet directory with folders labeled as indices to folders labeled as word net ids
mv 999/ n15075141/
mv 998/ n13133613/
mv 997/ n13054560/
mv 996/ n13052670/
mv 995/ n13044778/
mv 994/ n13040303/
mv 993/ n13037406/
mv 992/ n12998815/
mv 991/ n12985857/
mv 990/ n12768682/