Skip to content

Instantly share code, notes, and snippets.

View VoQn's full-sized avatar
:shipit:
I may be slow to respond.

Kazuhiro Mizushima VoQn

:shipit:
I may be slow to respond.
View GitHub Profile
@VoQn
VoQn / 呪い.hs
Last active August 29, 2015 14:05
「人を呪えば穴ふたつ」の論理を Haskell で実装したら居るはずのない死者が増え続けていく結果になった
module Main where
type People = Int -- 人間
type Grave = (Int, Int) -- 墓穴
呪う :: (People, People, Grave) -> (People, People, Grave)
呪う (0, 0, n) = (0, 0, n) -- 人間がいない
呪う (0, 1, (i, j)) = (0, 0, (i + 1, j + 1)) -- 死んでいくのみ
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("vimperator.kurinton.net") {
* {
margin: 0 !important;
padding: 0 !important;
}
h1 {
@VoQn
VoQn / checkers.pde
Created January 27, 2009 14:29
市松模様を出力するprocessing sketch
// Checkers
// bult with Processing
// Jan 27 2009
// by VoQn
color[] colors = new color[ 4];
Checker checker;
void setup(){
size(400,800);
@VoQn
VoQn / calculationExtra.java
Created February 9, 2010 15:41
可変長引数で最大,最小とか総和、総乗とか順列、組み合わせとか
class Calculator {
/**
*
* @param numbers
* @return A Object has value calculated by simple sum function from arguments.<br>
* If arguments is null, return null;
*/
public static Number sum(Number... numbers) {
double value = 0;
// -*- mode: java; coding: utf-8; -*-
public class RangeArray {
public static int[] range(int n) {
return range(0, n, 1);
}
public static int[] range(int k, int n) {
return range(k, n, 1);
package jp.ne.voqn.labs;
import java.util.Iterator;
/**
* <div>
* <p>
* like function of Python "range()".<br/>
* <code>&gt&gt&gt range(10)</code> <br/>
* returns <code>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]</code> <br/>
#! /opt/local/bin/gosh -i
;; -*- mode: scheme; coding: utf-8 -*-
;;; SICP ex2.45
;;; define "split" procedure
(define right-split (split beside below))
(define up-split (split below beside))
(define (split first-modify second-modify)
(lambda (painter)
"""
FizzBuzz Program Visualization
Author by VoQn mail: voqn.tyrantist(AT)gmail.com
Inspirated by "Don't Overthink FizzBuzz"
http://weblog.raganwald.com/2007/01/dont-overthink-fizzbuzz.html
>>> fizzbuzz(1)
1
>>> fizzbuzz(3)
;; -*- mode: emacs-lisp; coding: utf-8 -*-
;; set applescript to open and run Spde sketch
(defvar apple-script-file
"~/.emacs.d/etc/openAndRunSketch.applescript")
;; set application name of Spde
(defvar application-name "Spde")
;; run applescript
(*
Open & Run Generative Programming IDE
Author: VoQn
Usase:
ex Processing
$osascript openAndRunSketch.applescript Processing ~/Documents/Processing/sketch/sketch.pde
ex NodeBox
$osascript openAndRunSketch.applescript NodeBox ~/Documents/NodeBox/sketch.py