Skip to content

Instantly share code, notes, and snippets.

loggingDecoder : Decoder a -> Decoder a
loggingDecoder decoderToDebug =
D.value
|> D.andThen
(\value ->
case D.decodeValue decoderToDebug value of
Ok decoded ->
D.succeed decoded
Err error ->
function prepare_returns_matrix(account, number_of_scenarios, scenarios_length, interval)
classes_returns =
[:gbp_uk_aggregate_bonds, :gbp_uk_equities] |> # replace with the classes you want to see the correlations
class_name -> DataLoader.get_returns_matrix(
class_name,
scenarios_length,
interval
),
using CSV
DATA = CSV.read("v2_historical_data.csv", missingstring="-")
foreach( names(DATA) ) do name
missing = true
foreach(DATA[name]) do data
if missing
missing = typeof(data) == Missing
#!/bin/bash
docker kill $(docker ps -q)
docker build -t timeline-calc . \
&& docker run --log-driver=syslog --log-opt syslog-address=udp://logs7.papertrailapp.com:24524 -d --rm -p 8080:8080 timeline-calc \
&& say "done" && docker attach $(docker ps -q)
#!/bin/bash
if git checkout master && git pull origin master; then
cd test/
echo "running tests ..."
if julia runtests.jl; then
say "tests OK"
cd ../
if gcloud app deploy -q --image-url="gcr.io/timeline-pdf/github.com/devnacho/timeline-calc:$(git rev-parse HEAD)"; then
say "deploy successful, engines online, weapons online, all systems nominal"
#!/bin/bash
docker kill $(docker ps -q)
cd test/
echo "running tests"
julia runtests.jl && say "tests done" && cd ../ && docker build -t timeline-calc . && docker run -dit --rm -p 8080:8080 timeline-calc && say "done" && docker attach $(docker ps -q)
test/ # this directory contains the tests for the Calculus module
runtests.jl # this file runs the tests
using Calculus # obviously the tests use the Calculus module...
using Base.Test # and the Base.Test module...
tests = ["finite_difference", ... # the test file names are stored as strings...
for t in tests
include("$(t).jl") # ... so that they can be evaluated in a loop
end
...
finite_difference.jl # this file contains tests for finite differences,
#!/usr/bin/env groovy
import javafx.embed.swing.JFXPanel;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
// if we can access google, we can access everything (?)
fxPanel = new JFXPanel();
file = new File("msg.mp3"); // of course you need a suitable audio file of your own
media = new Media(file.toURI().toString());
@alejandrociatti
alejandrociatti / Quadforce.pde
Last active June 23, 2016 23:43
Rotating "quadforce" (4 tetrahedrons forming a big one with an inverted one inside the 4)
class Quadforce{
Tetrahedron tetra;
float edgeLength;
Quadforce(float radius){
tetra = new Tetrahedron(radius);
edgeLength = tetra.a;
}
void create(){
module = angular.module 'app.directives', []
module.directive 'dDraggable', ->
return {
scope:
index:'@?'
link: (scope, element, attrs) ->
element = $(element)
element.attr('draggable', 'true')
data = element.data()