This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns sample.kmeans | |
(:import [processing.core PVector]) | |
(:use quil.core)) | |
(def group-num 10) | |
(def point-num 300) | |
(def max-x 700) | |
(def max-y 700) | |
(def points (take point-num (repeatedly #(new PVector (rand-int max-x) (rand-int max-y))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn spare? [t1 t2] | |
(= 10 (+ t1 t2))) | |
(defn spare-score [[next-pin]] | |
(+ 10 next-pin)) | |
(defn strike? [t1] | |
(= 10 t1)) | |
(defn strike-score [[first-pin second-pin]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
simple key value store (in memory) | |
inspired by tristanwietsma/jack v0.1 | |
https://github.com/tristanwietsma/jack | |
""" | |
from argparse import ArgumentParser | |
from asyncio import ( | |
Protocol, | |
coroutine, | |
get_event_loop, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/tako2/7734472 I was reffering. | |
open System | |
open System.Net.Sockets | |
open System.Text | |
type Result<'a, 'b> = | |
| Success of 'a | |
| Failure of 'b | |
type MaybeBuilder() = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns twinkle.core | |
(:require [quil.core :as q]) | |
(:require [quil.middleware :as m])) | |
(def sky-size {:w 640 :h 350}) | |
(def star-size {:w 30 :h 30}) | |
(def min-radius 10) | |
(def max-radius 20) | |
;-- point ---------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns sheep.core | |
(:require [quil.core :as q]) | |
(:require [quil.middleware :as m]) | |
(:require [sheep.delaunay :as d])) | |
(def next-color! | |
(let [current (atom 50) | |
hue (atom 150)] | |
(fn [] (let [b (swap! current (fn [_] (+ 70 (rand-int 30)))) | |
hue (swap! hue (fn [_] (+ 150 (rand-int 40))))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod tokenizer { | |
#[derive(Eq, PartialEq, Show)] | |
pub enum Token { | |
Open, Close, | |
String(String), | |
Number(String), | |
Symbol(String), | |
} | |
/// LISPのS式を字句解析する |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
class InvalidArgumentException(Exception): | |
pass | |
class Color: | |
def __init__(self, r, g, b): | |
self.red = r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -e | |
rustc -o $1.rso $1 | |
./$1.rso ${@:2:$#-1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
led_nums = [ | |
[" _ ", "| |", "|_|"], | |
[" ", " |", " |"], | |
[" _ ", " _|", "|_ "], | |
[" _ ", " _|", " _|"], | |
[" ", "|_|", " |"], | |
[" _ ", "|_ ", " _|"], |
OlderNewer