Skip to content

Instantly share code, notes, and snippets.

@mandel59
mandel59 / tasks.rs
Created January 25, 2012 04:33
spawns 10 tasks
use std;
fn main() {
int::range(0, 10) {|i|
task::spawn {||
std::io::println(#fmt("child: %d", i));
};
std::io::println(#fmt("spawned: %d", i));
}
}
@mandel59
mandel59 / times.rs
Created January 25, 2012 04:49
Iteration and interface-less implementations sample
use std;
fn p(i: int) { std::io::println(#fmt("%d", i)) }
impl times for int {
fn times(f: fn(i: int)) { int::range(0, self, f) }
}
fn main() {
10.times {|i| p(i) }
}
@mandel59
mandel59 / boxing.rs
Created January 25, 2012 13:38
Shared box and unique box
use std;
import std::io::println;
fn main() {
// shared box
let i = @mutable 10;
println(int::str(*i)); // => 10
let j = i;
*j = 20;
println(int::str(*i)); // => 20
// unique box
@mandel59
mandel59 / jspeak
Created March 25, 2012 04:31
Open JTalkを使うためのシェルスクリプト
#!/bin/bash
VOICE_PATH=$HOME/works/MMDAgent_Example-1.1/Voice
if [ "x$VOICE" = "x" ] || ! [ -d "$VOICE" ] ; then
#VOICE=$HOME/works/hts_voice_nitech_jp_atr503_m001-1.04
VOICE="$VOICE_PATH"/mei_normal
fi
VOICES=( \
"$VOICE_PATH"/mei_normal \
"$VOICE_PATH"/mei_angry \
"$VOICE_PATH"/mei_bashful \
@mandel59
mandel59 / emoticons.txt
Created May 6, 2012 06:15
絵文字辞書
にっこり ☺ 顔文字
さんた 🎅 顔文字
いるか 🐬 顔文字
ねずみ 🐭 顔文字
うし 🐮 顔文字
とら 🐯 顔文字
うさぎ 🐰 顔文字
ねこ 🐱 顔文字
たつ 🐲 顔文字
りゅう 🐲 顔文字
@mandel59
mandel59 / seripara.v
Created June 27, 2012 16:17
これだと論理合成できないそうです
module seripara (clk, si, res, ena, q);
input si, res, ena, clk;
output [3:0] q;
reg [3:0] q;
reg [1:0] state;
always@(negedge res or posedge clk)
begin
@mandel59
mandel59 / yago_test.cxx
Created July 22, 2012 18:46
YAGO synthesizer の使い方。仕様は仮のもので、後で色々変更すると思う。
#include <iostream>
#include <yago.hxx>
int main()
{
constexpr float sample_rate = 44100.0f;
constexpr double delta_t = 1.0 / sample_rate;
constexpr std::size_t buffer_size = 1024;
float buffer[buffer_size];
yago::Oscillator<decltype(buffer)> osc(440);
@mandel59
mandel59 / mplus-jisx0213-unavailable.tsv
Created September 21, 2012 13:52
mplus jisx0213 unavailable codepoints
8258 U+2042
8273 U+2051
8463 U+210F
8481 U+2121
8741 U+2225
8742 U+2226
8842 U+228A
8843 U+228B
8922 U+22DA
8923 U+22DB
@mandel59
mandel59 / hello.go
Created October 14, 2012 07:31
Golang OpenGL Shader Example
// -*- coding: utf-8 -*-
// 参考: 床井研究室 - (4) シェーダの追加
// http://marina.sys.wakayama-u.ac.jp/~tokoi/?date=20120909
package main
import (
gl "github.com/chsc/gogl/gl33"
"github.com/jteeuwen/glfw"
"log"
"unsafe"
@mandel59
mandel59 / ttcext.go
Created November 1, 2012 17:06
TTC to TTF conversion
package main
import (
"flag"
"github.com/mandel59/gofont/otf"
"os"
)
var in *string = flag.String("in", "", "input file name")