Skip to content

Instantly share code, notes, and snippets.

View kamiyaowl's full-sized avatar
🤔
:thinking_face:

Kamiya kamiyaowl

🤔
:thinking_face:
View GitHub Profile
@kamiyaowl
kamiyaowl / Install_xubuntu12.04_with_scala
Last active August 29, 2015 13:56
Xubuntu12.04LTS+Scala開発環境構築
$sudo apt-get update
$sudo apt-get install vim zsh git ibus-mozc
#zshをデフォに
$which zsh
/usr/bin/zsh
$chsh
#GoogleDrive経由でsshやらgitとかconfigをzipでもらってunzipして配置
@kamiyaowl
kamiyaowl / scala_for_to_until.scala
Created February 8, 2014 16:13
toとuntilの違い
val x = 5
for(i <- 0 to x){ print(i) }
//012345
for(i <- 0 until x){ print(i) }
//01234
@kamiyaowl
kamiyaowl / install_node
Last active August 29, 2015 13:56
nodebrewでnode.js環境構築
$curl -L git.io/nodebrew | perl - setup
#export ~~~を追記するようにって出るから.zshrcに追記、sourceでリロード
$nodebrew install-binary v0.10.24
$nodebrew use v0.10.24
$node --version
v0.10.24
$npm --v
1.3.21
@kamiyaowl
kamiyaowl / setup-pi-gpio
Created February 13, 2014 14:30
rasberry pi環境構築まとめ
## gpio ##
#http://elinux.org/RPi_Low-level_peripherals
#gpio7でled点灯
root@raspberrypi:~# echo 7 > /sys/class/gpio/export
root@raspberrypi:~# echo out > /sys/class/gpio/gpio7/direction
root@raspberrypi:~# echo 1 > /sys/class/gpio/gpio7/value
root@raspberrypi:~# echo 0 > /sys/class/gpio/gpio7/value
@kamiyaowl
kamiyaowl / server.js
Created February 16, 2014 10:46
heroku+node.jsテスト「呼ばれてない」
var http = require('http');
http.createServer(function(req,res){
res.writeHead(301,{'Location': 'http://twitter.com/kam1yan___'});
res.end();
t.updateStatus('誰か来た(n回目)', null, function (data) {
});
}).listen(process.env.PORT || 3333);
var twitter = require('twitter');
var util = require('util');
@kamiyaowl
kamiyaowl / Procfile
Last active August 29, 2015 13:56
herokuにdeploy
web: node server.js
@kamiyaowl
kamiyaowl / monte.scala
Last active August 29, 2015 13:56
[scala]無限リストを用いたモンテカルロ法比較
package scalatan
import util.Random
import math._
object Main {
def main(args: Array[String]): Unit = {
def create() : Stream[Double] = {
Stream.cons(Random.nextDouble(),create())
}
@kamiyaowl
kamiyaowl / EightQueen.scala
Created February 20, 2014 03:04
8 Queen Problem with Scala
import scala.collection.immutable.IndexedSeq
object EightQueen {
def main(args:Array[String]):Unit = {
val DISABLE = "X"
//Queen pattern
val Identifier = "Q"
def upToDown(x:Int, y:Int) = (for(i <- 0 - {if(x < y) x else y} to 7 - {if(x > y) x else y}) yield (x + i,y + i))
def downToUp(x:Int, y:Int) = (for(i <- 0 - {if(x < 7 - y) x else 7 - y} to 7 - {if(x > 7 - y) x else 7 - y}) yield (x + i,y - i))
@kamiyaowl
kamiyaowl / Stick.scala
Created February 21, 2014 19:41
Scalaで迷路生成(棒倒し)
import scala.util.Random
object Stick {
def printMaze(m:Map[(Int,Int), String])(implicit size:(Int,Int)) = {
val w = size._1
val h = size._2
for(j <- 0 until h)
{
for(i <- 0 until w){
m.get((i,j)) match {
@kamiyaowl
kamiyaowl / Digging.scala
Created February 25, 2014 00:05
scalaで迷路(穴掘り法)
import scala.util.Random
object Digging {
def printMaze(m:Map[(Int,Int), String])(implicit size:(Int,Int)) = {
val w = size._1
val h = size._2
for(j <- 0 until h)
{
for(i <- 0 until w){
m.get((i,j)) match {