Skip to content

Instantly share code, notes, and snippets.

View ueliwechsler's full-sized avatar
💭
🐱‍🐉

ueliwechsler

💭
🐱‍🐉
  • Switzerland, Zurich
View GitHub Profile
@ueliwechsler
ueliwechsler / readJSON.jl
Last active June 21, 2018 07:49
Julia: read .json to strict #Julia, #JSON
using JSON
file = normpath(joinpath(@__DIR__,"..\\dsl\\historic_query.json"))
dict = open(file, "r") do f
dict = JSON.parse(f)
end
@ueliwechsler
ueliwechsler / workingWithDateTimes.jl
Created July 5, 2018 14:51
Shows some ways, how to work with DateTime format in Julia. #Julia #DateTime #time, #Dates
year, month, day = Dates.yearmonthday(now(Dates.UTC)); hour = Dates.Hour(now(Dates.UTC))
timeNow = DateTime(year,month,day,hour)
utc_start = [timeNow:Dates.Hour(1):timeNow+Dates.Hour(n-1)...]
timeNow = now(Dates.UTC)
utc_start = [Dates.format(value, "yyyy-m-dd HH:00:00") for value in timeNow:Dates.Hour(1):timeNow+Dates.Hour(n-1)]
using DifferentialEquations
α = 1
β = 0.1
γ = 0.05
δ = 0.02
function lotka_voltera!(dx, x, p, t)
dx[1] = α*x[1] - β*x[1]*x[2]
dx[2] = δ*x[1]*x[2] - γ*x[2]
# Example for Plots.jl http://docs.juliaplots.org/latest/#simple-is-beautiful
using Plots
# define the Lorenz attractor
mutable struct Lorenz
dt; σ; ρ; β; x; y; z
end
function step!(l::Lorenz)
dx = l.σ*(l.y - l.x) ; l.x += l.dt * dx
using BinaryBuilder
name = "Ipopt_Spral"
version = v"0.1.0"
## Sources
sources = [
GitSource("https://github.com/coin-or-tools/ThirdParty-Metis.git", "48d89108b173dcf74cc7a27d0beff0eb5eedadd5"), # master
GitSource("https://github.com/lanl-ansi/spral.git", "3842fffd5b16f0bf85be6f4b2832816ac4405763"), # master
GitSource("https://github.com/lanl-ansi/Ipopt.git", "78a05e2b9138074682a057297b61524f7cb32b53"), # master
cd ThirdParty-HSL/
./configure
make
make install