Skip to content

Instantly share code, notes, and snippets.

@yonta
yonta / build.sh
Last active August 29, 2015 14:14
SML# test
gcc -o hoge.o -c hoge.c
smlsharp -o run fuga.sml hoge.o
./run
@yonta
yonta / gist:331da7521a0caa17be40
Last active August 29, 2015 14:17
Lubuntu 14.10でLubuntu14.04-2LTSのカスタムLiveDVDを作る手順
# 14.10のカスタムを作ろうとするとビルド失敗する、よくわからない
# 開発に必要そうなのを一括でいれて、exitすればよい
# 下記コマンドによって開発環境を整える
add-apt-repository ppa:tualatrix/ppa && \
add-apt-repository ppa:webupd8team/java && \
apt-get update && \
apt-get upgrade && \
apt-get install oracle-java8-installer && \
apt-get install \
@yonta
yonta / Raspberry Pi 2 + Arduino IDE
Created April 24, 2015 10:29
How to use Arduino IDE in Raspberry Pi 2
How to use Arduino IDE 1.5.6-r2 in Raspberry Pi 2
---------------------------------------------------
written by Keita SAITOU in 2015/04/24
1. Getting Arduino IDE
* http://www.arduino.cc/en/Main/Software
* previous release -> Arduino 1.5.6-r2 BETA -> Linux 32bit
* decompressin by `tar xzf arduino1.5.6-r2.tar.gz`
@yonta
yonta / 職務履歴書.md
Last active January 22, 2016 03:56
職務履歴書

職務履歴書

勤務先会社名

非公開

勤務先資本金

約2000億円

@yonta
yonta / aobench
Last active April 2, 2016 15:39
Eldeshさんのaobenchやったらセグフォ
$ ./meta-aobench.sh
gcc is running
real 0m1.169s
user 0m1.168s
sys 0m0.000s
Standard ML of New Jersey v110.78 [built: Thu Jul 23 11:21:58 2015]
[scanning aobench.cm]
[library $SMLNJ-BASIS/basis.cm is stable]
[library $SMLNJ-LIB/Util/smlnj-lib.cm is stable]
@yonta
yonta / my_eval.el
Last active May 17, 2016 04:39
連番作るコマンドを作りたい
(setq my-repeat-num-command
"(loop for i from 1 to 10 do (insert (format \"%d\n\" i)))")
(defun my-insert-command () (insert my-repeat-num-command))
(defun eval-repeat-number ()
(progn
(add-hook 'eval-expression-minibuffer-setup-hook 'my-insert-command)
(eval-expression)
(remove-hook 'eval-expression-minibuffer-setup-hook 'my-insert-command)))
@yonta
yonta / not_copy.cpp
Last active September 26, 2016 12:56
// 実際はQtのライブラリであるQTimer
// https://github.com/radekp/qt/blob/master/src/corelib/kernel/qtimer.h#L98
class DisableCopy {
public:
explicit DisableCopy(Object *parent) { // 引数ありコンストラクタ
// ...
}
private:
DISABLE_COPY(DisableCopy) // マクロでコピーが禁止されている
};
@yonta
yonta / arrayheader.cpp
Created February 28, 2017 06:47
C++むつかしい
/*
1. クラス内で配列データを持ちたい
2. 配列は定数長
3. 定数長値をメソッドで使いたい
4. .hは定義、.cppは本体に分けたい
*/
// .h
#define N 4 // 最終手段感
class Example1 {
@yonta
yonta / init-env.sh
Last active June 7, 2024 14:28
Initialize environment script for WSL with Ubuntu or openSUSE
#!/bin/bash -eu
# https://qiita.com/youcune/items/fcfb4ad3d7c1edf9dc96
# -euでエラーか未定義変数でストップする
script_dir="$(cd $(dirname $0); pwd -P)"
# Color message
NORMAL=$(tput sgr0)
@yonta
yonta / int_option_minimum.sml
Last active June 7, 2018 06:09
How to get removed something and removed object, when you remove something from object in persistence data structure.
local
fun cleanHeadNone nil = nil
| cleanHeadNone (NONE :: t) = cleanHeadNone t
| cleanHeadNone (l as SOME _ :: _) = l
fun cleanEndNone l = (rev o cleanHeadNone o rev) l
fun simpleMin nil = raise Fail "Empty"
| simpleMin [NONE] = raise Fail "End with NONE"
| simpleMin [SOME x] = (x, nil)
| simpleMin (NONE :: t) = min t
| simpleMin (SOME x :: t) =