Skip to content

Instantly share code, notes, and snippets.

@myy
myy / ThereminiLeapMotion.pde
Last active July 20, 2018 05:33
ProcessingとLeapMotionでテルミンっぽいもの
import com.leapmotion.leap.*;
import ddf.minim.*;
import ddf.minim.signals.*;
Minim minim;
AudioOutput out;
SineWave sine;
com.leapmotion.leap.Controller controller = new com.leapmotion.leap.Controller();
void setup() {
@myy
myy / LeapMotionSample.pde
Last active July 15, 2016 10:35
Processing で LeapMotion を使うためのお試しコード.手のひらや指の位置を描画しようとしている.
import com.leapmotion.leap.*;
Controller controller = new Controller();
void setup() {
size(1000, 1000);
// ジェスチャーを有効にする
controller.enableGesture(Gesture.Type.TYPE_SWIPE);
controller.enableGesture(Gesture.Type.TYPE_CIRCLE);
@myy
myy / PrintTwStream.pde
Created November 2, 2013 05:24
twitter4jを使ってprocessingでひたすらツイートを表示させるだけ.Handyというライブラリも使ってます(http://gicentre.org/handy/).
import twitter4j.conf.*;
import twitter4j.internal.async.*;
import twitter4j.internal.org.json.*;
import twitter4j.internal.logging.*;
import twitter4j.http.*;
import twitter4j.internal.util.*;
import twitter4j.api.*;
import twitter4j.util.*;
import twitter4j.internal.http.*;
import twitter4j.*;
@myy
myy / ExtractMidiDataSample.java
Created October 22, 2013 09:24
MIDIファイルからデータをぶっこぬく
import javax.sound.midi.*;
import java.io.*;
/**
* MIDIファイルからデータをぶっこぬくコード<br>
* 参考:http://d.hatena.ne.jp/UDONCHAN/20090919/1253343146
* @author myy
*
*/
@myy
myy / myTimer_renew.html
Created September 13, 2013 01:53
とある講義のワークで制限時間を示す必要があったので, https://gist.github.com/myy/4029896 をサクッと改良したもの.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>タイマー</title>
</head>
<body>
<div style="font-size:100px">
<center><p><span id="minutes">0</span>分<span id="seconds">0</span>秒</p>
</div></center>
@myy
myy / randomOrder.html
Created April 26, 2013 09:55
1からNまでの整数を並べ替えるHTML版.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>1からNまでの整数をランダムに並び替える</title>
</head>
<body>
<h1>1からNまでの整数をランダムに並び替える</h1>
<p>並び替えたい数の最大値を入力してください: <input type="text" name="max" id="max" value="0" /> <input type="button" value="決定" onclick="getMax();" /></p>
@myy
myy / randomOrder.rb
Created April 26, 2013 09:52
1からNまでの整数をランダムに並び替える
# -*- encoding: utf-8 -*-
# 2012/11/01
# 1からNまでの整数をランダムに並び替える
# 上限値Nを入力してもらう
puts "並び替えたい数の上限値を入力してください"
max = gets.to_i
# 並び替え前の数字が入る配列と並び替え後の配列を用意する
@myy
myy / accel2buzz.ino
Last active December 16, 2015 09:29
// 加速度モジュールを使った楽器
// x軸方向で音程を変える
// y軸方向でオクターブを変える
// 置いてある状態のときには音を鳴らない
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
// ボタンを押すと圧電ブザーが鳴るプログラム
// ドレミファソの5音が鳴る
// Bounceライブラリを使って,バウンシングに対応する
#include <Bounce.h>
#include "pitches.h"
int button1Pin = 10;
int button2Pin = 8;
int button3Pin = 6;