Skip to content

Instantly share code, notes, and snippets.

@shuzo-kino
shuzo-kino / test-strtok.c
Created October 17, 2013 09:41
strtokの挙動
#include <string.h>
#include <stdio.h>
#define SIZE 10
int main() {
int i = 0;
char data[] = "foo bar piyo fuga";
char *argv[SIZE];
@shuzo-kino
shuzo-kino / install-anyenv.rb
Created October 10, 2013 13:58
Install the anyenv.
puts <<`_EOB_`
git clone --depth 1 https://github.com/riywo/anyenv ~/.anyenv
cat >> #{ARGV[0]} <<'_EOF_'
## anyenv setup
export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"
_EOF_
puts `exec $SHELL -l`
@shuzo-kino
shuzo-kino / truth-table.rb
Created October 5, 2013 09:08
再帰処理による真理値表((b0 || b1 && !b2)) 習作 元ネタ:再帰の技法 基本的考え方・アルゴリズム・プログラミング(ISBN-13: 978-4434085970)
$b = []
NUM = 3
def truth_table(k)
if k < NUM
$b[k] = false
truth_table(k+1)
$b[k] = true
truth_table(k+1)
else
@shuzo-kino
shuzo-kino / sample.c
Last active December 23, 2015 12:19
よくあるコマンド入力型の実行コード習作。structとtableを使うと比較的きれいに書ける。 gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)にて確認。
#include <stdio.h>
#include <string.h>
#define TRUE 0
#define FALSE -1
static void start(char argc, char **argv);
static void hello(char argc, char **argv);
typedef struct