Skip to content

Instantly share code, notes, and snippets.

@tacke758
tacke758 / coroutine.scm
Created April 20, 2014 02:16
coroutine implementation on scheme
(define proc1 '())
(define proc2 '())
(define (coroutine1)
(define (yield-for next-cnt)
(call/cc (lambda (cnt)
(set! proc1 cnt)
(next-cnt))))
(define (setup)
(call/cc (lambda (cnt)
@tacke758
tacke758 / draw_rotate_ellipse.c
Created June 19, 2013 06:32
UltraCで楕円を回転させて描画する関数
#include <stdio.h>
#include "graphic.h"
#include "math.h"
#define PARTITION 40
/**
* 楕円を回転させて描画する
* a 長辺の長さ
* b 短辺の長さ
@tacke758
tacke758 / CSV_linebreak_fix.c
Last active December 16, 2015 04:39
C program that removes escaped line breaks, which are surrounded by double quotes from CSV file and change it into unix style file format (using line feed (LF) as line break). This program implements an automaton that accepts CSV, so it's short and run fast.
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
/* Size of atomic reads. */
#define BUFFER_SIZE (16 * 1024)
int state = 0;
void exit_with_error(int state, char c) {
@tacke758
tacke758 / pomodoro.html
Last active December 14, 2015 04:19
quite simple pomodoro timer
<html>
<head>
<title> Pomodoro Timer </title>
<script type="text/javascript">
<!--
var minTextElem;
var secTextElem;
@tacke758
tacke758 / ok_pipe.js
Last active December 10, 2015 19:29 — forked from mironal/ok_pipe.js
Node.jsで標準入力から大きなデータの入力を受ける
process.stdin.resume();
process.stdin.setEncoding('utf8');
var fragment = "";
process.stdin.on('data', function(chunk){
if (chunk == "") { return ;}
var lines = chunk.split("\n");
lines[0] = fragment + lines[0];
fragment = lines.pop();
lines.forEach(function(line){
@tacke758
tacke758 / thesis_ref_line
Created February 3, 2012 05:33
Generate thesis reference bibitem line
<?php
$line = 'design Design of Evolvable Computer Languages 2002 IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION 6 4 420-424 Charles Ofria Christoph Adami Travis C. Collier'; // delimiter is tabstop
print thesis_reference_line($line);
// for each line of file
function thesis_reference_line($line)
{
// split with tab
$datas = explode("\t", $line);
@tacke758
tacke758 / address.dat
Created December 30, 2011 09:31
Simple Mail Sender
sample@gmail.com Mr.Sample
foo@gmail.com Ms.Foo