Skip to content

Instantly share code, notes, and snippets.

View ara-ta3's full-sized avatar

Arata Tanaka ara-ta3

View GitHub Profile
@ara-ta3
ara-ta3 / jenkins-install.sh
Created February 8, 2015 15:15
install script for jenkins to redhat system os
#! /bin/sh
yum install -y wget java-1.7.0-openjdk
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum install -y jenkins
service jenkins restart
@ara-ta3
ara-ta3 / Dockerfile
Created March 1, 2015 14:26
HelloDocker
FROM centos
MAINTAINER Arata Tanaka
# RUN:buildするときに実行される
RUN echo "now building ..."
# CMD: runするときに実行される
CMD ["echo", "now running..."]
@ara-ta3
ara-ta3 / install-vim74-itamae-recipe.rb
Created March 11, 2015 15:28
itamae用のvim7.4インストールレシピ
package "gcc"
package "mercurial"
package "ncurses-devel"
package "lua"
package "lua-devel"
execute "hg clone https://vim.googlecode.com/hg/ vim" do
cwd "/usr/local/src/"
not_if "test -d /usr/local/src/vim/src"
end
@ara-ta3
ara-ta3 / sqrt.go
Last active August 29, 2015 14:17
golang Sqrt
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(1)
const count = 10
@ara-ta3
ara-ta3 / SQLアンチパターン18章.sql
Created March 19, 2015 02:33
SQLアンチパターン18章
create table fuga(id int, name varchar(255));
create table piyo(id int, name varchar(255));
insert into fuga values(1, "fugafuga");
insert into piyo values(1, "fugafuga");
select * from fuga f inner join piyo p on f.id = p.id;
/*
+------+----------+------+----------+
| id | name | id | name |
+------+----------+------+----------+
| 1 | fugafuga | 1 | fugafuga |
@ara-ta3
ara-ta3 / fib.scala
Created March 25, 2015 09:51
フィボナッチ
def fibFrom(a:Long, b:Long): Stream[Long] = a #:: fibFrom(b, a+b)
println(fibFrom(0l, 1l).take(50).toList)
package my.twitter
import twitter4j._
import conf._
/*
* ref http://tototoshi.hatenablog.com/entry/20111104/1320377494
* libraryDependencies ++= Seq(
* "org.twitter4j" % "twitter4j-core" % "2.2.5",
* "org.twitter4j" % "twitter4j-stream" % "2.2.5"
<!DOCTYPE html>
<html>
<head>
<title>HTML5 でドラッグ&ドロップ</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script language="javascript">
$(function() {
var droppable = $("#droppable");
// File API が使用できない場合は諦めます.
@ara-ta3
ara-ta3 / yield.scala
Created March 31, 2015 11:04
for yieldを試してみたかった
val hoge:List[String] = List[String]("hoge", "fuga", "piyo")
println(hoge)
val fuga = for {
id <- hoge
} yield id + "__"
println(fuga)
/*
* List(hoge, fuga, piyo)
* List(hoge__, fuga__, piyo__)
@ara-ta3
ara-ta3 / collections.scala
Created April 4, 2015 11:56
Collection操作の時によく忘れるからメモ
object Main extends App {
// List
val sample1: List[Int] = List(1, 2, 3, 4, 5)
// map
// output -> List(2, 4, 6, 8, 10)
println(sample1.map(i => i * 2))