Skip to content

Instantly share code, notes, and snippets.

🤔
:thinking_face:

Kamiya kamiyaowl

🤔
:thinking_face:
Block or report user

Report or block kamiyaowl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View scala_for_to_until.scala
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 Aug 29, 2015
nodebrewでnode.js環境構築
View install_node
$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 / Install_xubuntu12.04_with_scala
Last active Aug 29, 2015
Xubuntu12.04LTS+Scala開発環境構築
View Install_xubuntu12.04_with_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 / setup-pi-gpio
Created Feb 13, 2014
rasberry pi環境構築まとめ
View setup-pi-gpio
## 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 / Procfile
Last active Aug 29, 2015
herokuにdeploy
View Procfile
web: node server.js
@kamiyaowl
kamiyaowl / server.js
Created Feb 16, 2014
heroku+node.jsテスト「呼ばれてない」
View server.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 / monte.scala
Last active Aug 29, 2015
[scala]無限リストを用いたモンテカルロ法比較
View monte.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 Feb 20, 2014
8 Queen Problem with Scala
View EightQueen.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 Feb 21, 2014
Scalaで迷路生成(棒倒し)
View Stick.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 Feb 25, 2014
scalaで迷路(穴掘り法)
View Digging.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 {
You can’t perform that action at this time.