This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
main(); | |
// 終了 | |
exit; | |
function zero_array() { | |
$ret = array(); | |
for ($i = 0; $i < 255; $i++) { | |
$ret[$i] = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AppDelegate.h | |
#import <Cocoa/Cocoa.h> | |
@interface AppDelegate : NSObject <NSApplicationDelegate, NSUserNotificationCenterDelegate> | |
// Windowはいらないのでxibファイルから消しておく | |
@property (assign) IBOutlet NSWindow *window; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear; | |
alpha = rand(1, 1000); | |
beta = rand(1, 1000); | |
val1 = sqrt(-2 * log(alpha)) .* sin(2 * pi * beta); | |
val2 = sqrt(-2 * log(alpha)) .* cos(2 * pi * beta); | |
hist([val1,val2], 20); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SRC_DIR = src | |
.PHONY: test | |
FILES = ${SRC_DIR}/api.js ${SRC_DIR}/trap.js ${SRC_DIR}/typechecker.js ${SRC_DIR}/all.js | |
CONCAT_FILE = struct.js | |
MINIFY_FILE = struct.min.js | |
default_target: all | |
TARGET = clean concat minify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fast_fib_module(stdlib, foreign, heap) { | |
"use asm"; | |
function fib(n) { | |
n = n|0; | |
// nはint(符号の有無が不明の状態) | |
// 3はfixnum(0~2^31) | |
// 比較するためにnをシフト演算でunsignedに変換する | |
if (n >>> 0 < 3) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> scores <- read.delim('./alldate_scale1.csv', sep = ',', header = TRUE) | |
> summary(scores) | |
value.loc.lat value.loc.lon value.score value.low | |
Min. :20.0 Min. :120.0 Min. :0.0844 Min. :0.0000 | |
1st Qu.:27.5 1st Qu.:127.5 1st Qu.:0.2466 1st Qu.:0.0000 | |
Median :35.0 Median :135.0 Median :0.3043 Median :0.0000 | |
Mean :35.0 Mean :135.0 Mean :0.3054 Mean :0.7569 | |
3rd Qu.:42.5 3rd Qu.:142.5 3rd Qu.:0.3612 3rd Qu.:1.8016 | |
Max. :50.0 Max. :150.0 Max. :0.5777 Max. :3.0000 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Code for generate JavaScript code, to aggregate mongo | |
if [ $# -ne 2 ]; then | |
cat <<__EOT__ | |
Give me two parameters | |
- Decimal place of Resolution (If set 2, output resolution is 0.01) | |
- Aggregate collection name | |
Usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = new WebPage(), | |
address, output, size; | |
if (phantom.args.length != 2) { | |
console.log('Give me URL and filename'); | |
phantom.exit(); | |
} else { | |
address = phantom.args[0]; | |
output = phantom.args[1]; | |
page.viewportSize = { width: 1024, height: 768 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "ubuntu-12.04-x64" | |
config.vm.define :ap_server1 do |ap| | |
ap.vm.hostname = "ap1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import pika | |
def get_connection(): | |
mq_clusters = ['rabbit1', 'rabbit2'] | |
random.shuffle(mq_clusters) | |
for mq in mq_clusters: | |
try: | |
params = pika.ConnectionParameters(mq) | |
connection = pika.BlockingConnection(params) |