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 conn = new Mongo(); | |
var db = conn.getDB("oacis_development"); | |
var map = function() { | |
// var key = {param1: this.v["L"], param2: this.v["T"] }; | |
var key = [ this.v["beta"], this.v["h"] ]; | |
if( this.runs_status_count_cache ) { | |
var cache = this.runs_status_count_cache; | |
var total_runs = 0; | |
for(var stat in cache) { |
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
# calculate ensemble average and its statistical error of dat files | |
# | |
# the format of the input file is defined as follows | |
# each line contains key and values separated by space as follows | |
# <key> <val1> <val2> <val3> ... | |
# all the file do not necessary have the same keys | |
# When key is not found, the value is assumed to be zero | |
# | |
# output file format is | |
# <key> <ave_val1> <err_val1> <ave_val2> <err_val2> ..... |
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
require 'pp' | |
class Histogram | |
def self.normal_histo(data) | |
histo = Hash.new(0) | |
data.each do |d| | |
histo[d] += 1 | |
end | |
histo.sort_by {|a| a[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
\documentclass[11pt]{article} | |
\usepackage{graphicx} | |
\begin{document} | |
\title{} | |
\author{} | |
\date{\today} | |
\maketitle |
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
def alphametic(input) | |
candidate = (input =~ /[\+=]X/ or input =~ /^X/) ? 1..9 : 0..9 | |
candidate.find {|i| eval(input.gsub('X', i.to_s).sub('=', '==')) } || "NA" | |
end | |
if __FILE__ == $0 | |
while line = gets | |
puts alphametic(line.chomp) | |
end | |
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
require 'pp' | |
def f(x_vec) | |
a0 = 10.0 | |
vec = [0.0, 1.0, 2.0, 3.0] | |
y = a0 + vec.zip(x_vec).map {|c,x| c * x }.inject(:+) | |
y += 2.0 * x_vec[0] * x_vec[3] | |
y | |
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
#!/bin/bash | |
######################################### | |
# OACIS installer for Ubuntu14.04 64bit # | |
######################################### | |
#build environment | |
sudo su - -c " | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 | |
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/mongodb.list |
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
require 'pp' | |
class Pendulum | |
def initialize(x, y, r) | |
@origin = PVector.new(x, y) | |
@r = r | |
@angle = Math::PI / 4 | |
@a_velocity = 0.0 | |
@a_acceleration = 0.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
require 'pp' | |
require 'ruby-fann' | |
def f(x,y) | |
Math.exp(- ((x-1.0)/2.0)**2 - (y/1.0)**2 ) | |
end | |
n = 100 | |
inputs = [] | |
n.times do |i| |
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
#include <iostream> | |
#include <boost/asio.hpp> | |
namespace asio = boost::asio; | |
int main() { | |
asio::io_service io_service; | |
asio::ip::tcp::socket socket(io_service); | |
socket.connect( asio::ip::tcp::endpoint( asio::ip::address::from_string("127.0.0.1"), 31400 ) ); |
OlderNewer