Skip to content

Instantly share code, notes, and snippets.

View ssov's full-sized avatar

SHIMANUKI Toshiyuki ssov

View GitHub Profile
import random
for alpha in (0.3,0.5,0.7):
t1=[]
random.seed(149) or [t1.append(0) for i in range(0, 20-int(alpha*20))] and [t1.append(1) for i in range(0, int(alpha*20))] and random.shuffle(t1)
print "\ndensity: %f\nt= 0 "%alpha,"".join(map((lambda x:str(x)+" "), t1))
for i in range(1,21):
t2=[]
[t2.append((0,0,0,1,1,1,0,1)[int("".join(map(str, map((lambda x:t1[x]), j-1<0 and (19,0,1) or j+1>=20 and (18,19,0) or (j-1,j,j+1)))),2)]) for j in range(0,20)]
t1=t2[:]
print "t=%2d "%i,"".join(map((lambda x:str(x)+" "), t2))
@ssov
ssov / gist:1592539
Created January 11, 2012 02:12
何かアレ
int speaker=11;
#define Do 523
#define Re 587
#define Mi 659
#define Fa 698
#define So 783
#define Ra 880
#define Si 987
#define DoU 1046
@ssov
ssov / gist:1673768
Created January 25, 2012 00:27
あれ
void setup()
{
int i;
for(i=2; i<=11; i++) {
pinMode(i, OUTPUT);
}
}
void loop()
{
@ssov
ssov / gist:1673902
Created January 25, 2012 01:01
あれあれあれ〄
int pov[10][10] = {
{0,1,1,1,1,1,1,1,1,1},
{1,0,0,0,1,0,0,0,0,0},
{1,0,0,0,1,0,0,0,0,0},
{1,0,0,0,1,0,0,0,0,0},
{0,1,1,1,1,1,1,1,1,1},
};
void setup()
{
@ssov
ssov / gist:1703656
Created January 30, 2012 10:02
あれの機械語のあれ年度のあれの4
.data
.align 4
x: .long 1, 2, 1, 2, 1
.text
.globl main
main:
push $5
push $x
push $1
@ssov
ssov / gist:1824384
Created February 14, 2012 07:06
unfavorite
$(".favorited .dogear").parent("div").children("div.content").children("div").children("div").children("div").children("ul").children("li").children("a").children("b").children(".unfavorite").click()
@ssov
ssov / gist:1832471
Created February 15, 2012 01:56
あれの〄のあれ
// 点灯時間
const int msec = 1;
const int num = 8;
const int row[num] = {11, 12, 14, 15, 16, 17, 18, 19};
const int col[num] = {2, 3, 4, 5, 6, 7, 8, 9};
void setup() {
for (int i = 0; i < num; i++)
pinMode(row[i], OUTPUT); // 行側のピンの初期化
for (int i = 0; i < num; i++)
@ssov
ssov / gist:1880383
Created February 22, 2012 01:14
ねむい〄
#include <Sprite.h>
#include <Matrix.h>
Matrix mtx = Matrix(3, 5, 4);
Sprite I = Sprite( // スプライト 1 文字目
8, 7,
@ssov
ssov / gist:1880529
Created February 22, 2012 01:43
ぷくぷく
#include <Sprite.h>
#include <Matrix.h>
Matrix mtx = Matrix(3, 5, 4);
Sprite I1 = Sprite( // スプライト 1 文字目
8, 8,
B00000000,
@ssov
ssov / gist:1985654
Created March 6, 2012 10:46
tmuxの右下のステータスバーにツイート表示するよ[えすけーぷした]
# -*- coding: utf-8 -*-
Plugin.create(:mikutter_tmux) do
on_update do |service, message|
message.each do |m|
begin
m.to_s.sub(/(.)/) { '\\' + $1 }
m.to_s.sub("#", "#")
system("tmux set status-right '#[fg=cyan][@" + m.idname + "] " + "#[fg=green]" + m.to_s[0,80] + "#[default]'")
rescue => ex
puts ex.message