Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Keisuke OTAKI cocomoff

🏠
Working from home
Block or report user

Report or block cocomoff

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 Marray.scala
val array = Array.ofDim[Int](2, 3)
println(array.deep)
/* Output
Array(Array(0, 0, 0), Array(0, 0, 0))
*/
View boost_version.cpp
#include <iostream>
#include <boost/version.hpp>
using namespace std;
int main()
{
cout << ( BOOST_VERSION / 100000 ) << "." << ( BOOST_VERSION / 100 % 1000 ) << "." << BOOST_VERSION % 100;
}
View gist:3f3d7a918c82f46ea9c2
#include <ilcplex/ilocplex.h>
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
const int num_of_threads = 1;
int main () {
@cocomoff
cocomoff / build.sbt
Created Oct 25, 2014
org.apache.commons.math3 from scala (sbt)
View build.sbt
libraryDependencies += "org.apache.commons" % "commons-math3" % "3.2"
@cocomoff
cocomoff / fib.py
Created Mar 11, 2015
適当にタイムアウトするsubprocess利用(Python 2.7.9)
View fib.py
# coding: utf-8
import time
def fib(n):
nums = []
a, b = 1, 1
# while b <= n:
while len(nums) <= n:
a, b = b, a+b
@cocomoff
cocomoff / langton.py
Created May 28, 2015
Build png files for a GIF anime of Langton's ant
View langton.py
# -*- coding: utf-8 -*-
# date: 2015/05/28
# author: @taki__taki__
# packages
import numpy as np
import matplotlib.pyplot as plt
# direction (N=0, E=1, S=2, W=3)
class Direction(object):
View yakinamashi.py
# -*- coding: utf-8 -*-
# author: @taki__taki__
# date: 30/06/2015
from random import random
from math import exp
class SA(object):
# function
def f(self, x):
View graph.py
# -*- coding: utf-8 -*-
# author: @cocomoff
# date: 30/06/2015
import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
x = np.arange(-50, 50, 1, dtype='float')
z = x / 10.0
@cocomoff
cocomoff / ground_distance.jl
Created Feb 20, 2017
Computing Ground Distance on Earth from Latitude/Longtitude Point (e.g., http://www.nhc.noaa.gov/gccalc.shtml)
View ground_distance.jl
R = 6371000 # Radius of the Earth
S1 = Point(35.18028,136.90667) # Nagoya
S2 = Point(35.68944,139.69167) # Tokyo
# ground distance
function dG(Si::Point, Sj::Point)
φi, λi = deg2rad(Si.φ), deg2rad(Si.λ)
φj, λj = deg2rad(Sj.φ), deg2rad(Sj.λ)
v1 = sin( (φj - φi) / 2 )
v2 = sin( (λj - λi) / 2 )
View jump_sample.jl
# example: http://www.fujilab.dnj.ynu.ac.jp/lecture/system2.pdf
using JuMP
using Clp
m = Model(solver = ClpSolver())
@variable(m, 0 <= x1 <= Inf)
@variable(m, 0 <= x2 <= Inf)
# 目的関数
You can’t perform that action at this time.