Skip to content

Instantly share code, notes, and snippets.

@lesguillemets
lesguillemets / NerveSystem.py
Created October 2, 2013 09:40
nerve system emulator (?) license : MIT
#!/usr/bin/python
# encoding:utf-8
import random
THRESHOLD = 1 # threshold for neuron's firing.
SYNAPSE_LIMIT = 4 # how strong synapses are allowed to be.
LTPRATIO = 1.1 # LTP : strength = strength*LTPRATIO
FORGETRATIO = 0.95 # A little forgetfullness
SUPPRESSION_RATIO = 0.5 # the frequency of suppressive synapses
SUP_WEAKNESS = 0.7 # when initialising,
#!/usr/bin/python
# encoding:utf-8
import random
class Neuron(object):
# 神経細胞体 class.
# i) synapse からの入力を受けることができ,
# ii) ある間にうけた入力の総和が threshold を超えれば
# iii) 発火し,本人から出ていく synapse に伝達される.
# 1
for element in a
do_something_with(element)
end
# 2
a.each do |element|
do_something_with(element)
end
for element in a:
do_something_with(element)
class Hello(object):
def __init__(self, friend):
self.friend = friend
def sayhello(self):
print "Hello, %s!"%(self.friend)
# helloworld = Hello('World')
# helloworld.sayhello()
@lesguillemets
lesguillemets / listen_to_skype.bash
Created August 26, 2013 15:13
skype の シューーン↑↑ \ぴょっ/ を耐久 400 回.聞きたくてたまらないあなたに. aplay の入ってる環境でしか動作しません.Mac なら afplay でうまくいくかもしれないとの噂. もちろん skype の音声ファイルの場所が違うかもしれませんしその辺はよきにはからえ.
#!/bin/bash
for i in `seq 1 400`;
do
printf "%3d\t" "$i"
aplay /usr/share/skype/sounds/SkypeLogin.wav
done
print "Hello, World!\n"
# on python 3.*, print ("Hello, World!\n")