Skip to content

Instantly share code, notes, and snippets.

View giwa's full-sized avatar

Ken Takagiwa giwa

  • Nombre Premier
  • Tokyo
View GitHub Profile
@giwa
giwa / db_bench.py
Created October 4, 2014 10:54
Simple Bench mark for dbs via python api
# Bench mark for dbs via python api
# Support DBs
# - MongoDB via pymongo
# - Sqlite3 via sqlite3
#
import sys
import time
from pymongo import MongoClient
@giwa
giwa / type_indetifer.py
Last active August 29, 2015 14:07
Identify type of string.
# Provide function to identify the data type
import socket
class TypeIdentifer(object):
_identifers=list()
@staticmethod
def is_int(s):
"""
@giwa
giwa / LMVExtend
Last active August 29, 2015 14:07
add LVM and extend existed volume
Personal memo for extend LVM voule
Disk /dev/vda: 317.1 GB, 317085921280 bytes
255 heads, 63 sectors/track, 38550 cylinders, total 619308440 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009c06d
Device Boot Start End Blocks Id System
/dev/vda1 * 63 1028159 514048+ 83 Linux
@giwa
giwa / stat_basic.py
Last active August 29, 2015 14:08
Set of basic statistic operations
# Set of basic statistics operations
#
import math
def median(items):
"""
Return median
if number of items is odd, return average of 2 middles.
#!/bin/bash
# chkconfig: 345 20 80
# description: Play start/shutdown script
# processname: play
#
# Instalation:
# copy file to /etc/init.d
# chmod +x /etc/init.d/play
# chkconfig --add /etc/init.d/play
# chkconfig play on
@giwa
giwa / init.d play
Last active August 29, 2015 14:11 — forked from bihe/init.d play
#!/bin/sh
### BEGIN INIT INFO
## END INIT INFO
# Path to play install folder
PLAY_HOME=/usr/share/play
PLAY=$PLAY_HOME/play
# Path to the JVM
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
package main
import "fmt"
func main() {
// Stringsは+で足すことができる。
fmt.Println("go" + "lang")
// intgers と float
fmt.Println("1+1 =", 1+1)
brew update
brew install go
package main
import "fmt"
func main() {
// 1個以上の変数を宣言することができる。
var a string = "initial"
fmt.Println(a)
package main
import "fmt"
import "math"
// 定数は constで宣言される。
const s string = "constant"
func main() {