Skip to content

Instantly share code, notes, and snippets.

/** Immutable 0-indexed Binary Index Tree (BIT) */
case class BinaryIndexedTree[A](size: Int, cumulatives: Vector[A])(implicit num: Numeric[A]) {
require(cumulatives.size == size + 1)
/** Return the sum of the values indexed from 0 to index (time: O(log(size))) */
def sum(until: Int): A = {
@annotation.tailrec
def f(n: Int, sofar: A): A =
if (n == 0)
sofar
@mogproject
mogproject / CubaseCheatSheet.md
Last active June 19, 2017 16:31
Cubase Cheat Sheet

Cubase Pro 8

調・拍子の設定

  • Command-B: Browse Project
  • Tempo Track
  • Signature Track

メトロノームを鳴らす

@mogproject
mogproject / SSHTroubleshooting.md
Last active January 23, 2016 05:09
Troubleshooting Guide for SSH Connection Error

ssh が繋がらないときのトラブルシューティングまとめ

ssh -vvvv 出力例

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/xxx/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
@mogproject
mogproject / AWSCLICheatSheet.md
Last active August 29, 2015 14:23
AWS CLI Cheat Sheat

対話的な config 設定

$ aws configure
AWS Access Key ID [None]: XXXXXX
AWS Secret Access Key [None]: XXXXXX
Default region name [None]: ap-northeast-1
Default output format [None]:
@mogproject
mogproject / PythonUnitTestCheatSheet.md
Created July 24, 2015 11:17
Python unittest Cheat Sheet

Python unittest Cheat Sheet

Skeleton

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mogproject
mogproject / SSHCheatSheet.md
Last active August 31, 2015 06:34
SSH Cheat Sheet

SSH キーペアの作成

ssh-keygen -t rsa -f ~/.ssh/your_key_name -C 'yourname@example.com'
  • パスフレーズはプロンプトから入力

これで

@mogproject
mogproject / ImageConversionCheatSheet.md
Created September 17, 2015 15:27
Image Conversion Cheat Sheet

svg -> png

/Applications/Inkscape.app/Contents/Resources/bin/inkscape \
--without-gui --export-width={{ WIDTH }} \
--file {{ INPUT }}.svg --export-png={{ OUTPUT }}.png
@mogproject
mogproject / SubwayCheatSheet.md
Last active January 23, 2016 00:40
Ordering at Subway is quite hard for foreigners, so I wrote a cheat sheet.

How to Order a Sandwich at Subway

1. Size & Bread

Size
  • 6-inch
  • Footlong
@mogproject
mogproject / MateProblems.md
Last active May 13, 2017 22:15
Mate problem list