Skip to content

Instantly share code, notes, and snippets.

View prayerslayer's full-sized avatar
💭
/o\

Nikolaus Piccolotto prayerslayer

💭
/o\
View GitHub Profile
const w = 400,
h = 400;
const cardWidth = 40,
cardAspectRatio = 64 / 89,
cardHeight = cardWidth / cardAspectRatio;
let trajectories = [];
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
@prayerslayer
prayerslayer / CorrelationMapExample.vue
Last active March 17, 2021 16:52
Vega as Vue (v2) Component
<template>
<Vega :signals="['inputVarsInMap']" :spec="spec" :values="correlations" />
</template>
<script lang="ts">
import { StoreState } from "@/types/store";
import { melt } from "@/util/matrix";
import { Component, Vue } from "vue-property-decorator";
import Vega from "@/components/Vega.vue";
import spec from "./spec.json";
[[[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0.4668,0.4945,0.6675,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0.354,0.4484,0.5602,0.666,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0.2421,0.2826,0.5497,0.6138,0.7884,0.8784,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0.2565,0.4497,0.5114,0.7297,0.8703,1.0492,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0.2468,0.4545,0.6246,0.7119,0.7989,1.1023,1.2596,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0.1683,0.2022,0.4556,0.602,0.625,0.8454,1.0505,1.2883,null,null,null,null,nu
@prayerslayer
prayerslayer / data.csv
Created December 3, 2019 14:46
Sine vs Noise
Series 1
1 4.15958780843744
2 1.63873028828538
3 0.808056534758816
4 -3.57917802735856
5 -2.28096957572749
6 -0.239099580918422
7 3.95655522885885
8 3.01897073368165
9 0.915924677901633
@prayerslayer
prayerslayer / all.csv
Last active November 12, 2019 10:09
Time series with stochastic volatility
We can't make this file beautiful and searchable because it's too large.
"","Series 1","Series 2","Series 3","Series 4","Series 5","Series 6","Series 7","Series 8","Series 9","Series 10","Series 11","Series 12","Series 13","Series 14","Series 15","Series 16","Series 17","Series 18","Series 19","Series 20","Series 21","Series 22","Series 23"
"1",-1.52638379307633,-1.83878434075978,-0.906173265867607,2.89620549217749,-0.697546956947543,-0.295814983336317,-0.815041680432233,1.70581589765478,1.23810398810873,0.101148935398539,4.17729001128286,0.160389526509387,0.195972137512933,1.65265219728888,1.62410405026759,-0.49267407814887,-0.455887270569605,3.7446321600723,0.583349853741263,-1.61125561789179,1.8916310785271,2.14386094737502,-1.4686715046996
"2",1.47138909041492,1.04417770638059,-0.664747468541355,1.81424724207809,-0.0998763716001783,0.341366544564051,-0.376621810872218,0.339699836932428,-1.86772583000559,1.16190861510723,0.693450637066536,-0.869666119854587,0.410045351661702,-0.0171653899406162,-0.0312663435852269,2.69597689435474,0.0368781307637233,1.44650628823362,-0.39863928
@prayerslayer
prayerslayer / temp.csv
Created October 15, 2019 13:31
Daily max temperature (degree Celsius) in Landeck, Austria (1948–2009)
y m d degree
1948 9 3 19.1
1948 9 4 21.1
1948 9 5 20.1
1948 9 6 19.1
1948 9 7 15.2
1948 9 8 18.1
1948 9 9 22.1
1948 9 10 25.2
1948 9 11 26.3
@prayerslayer
prayerslayer / elapsed_by_keyword.py
Created January 28, 2019 16:29
Find slow Robot Framework keywords
#!/usr/bin/env python
"""Usage: elapsed_by_keyword path/to/output.xml
Reads result of a test run from Robot output file
and outputs "keyword elapsed_time"
sorted by the elapsed time in each keyword.
"""
import sys
@prayerslayer
prayerslayer / find_color.js
Created May 7, 2018 15:34
Find used colors on page
function colorCount() {
function trim(str) {
return str.replace(/^\s+|\s+$/gm, '');
}
function toComponents(str) {
return str.match(/rgba?\((.+)\)/)[1].split(',').map(s => s.trim()).map(s => parseInt(s, 10))
}
function componentToHex(c) {
@prayerslayer
prayerslayer / gist.js
Last active September 29, 2017 20:43
8x8 Matrix with 10 1s on random positions
function shuffle(a) {
for (let i = a.length; i; i--) {
let j = Math.floor(Math.random() * i);
[a[i - 1], a[j]] = [a[j], a[i - 1]];
}
return a;
}
function range(n) {
return new Array(n).fill(0).map((_, i) => i);
@prayerslayer
prayerslayer / output.txt
Last active September 28, 2015 13:23
Tests JSON encoding performance of different clojure libs
content length
5073891
cheshire
"Elapsed time: 103.332902 msecs"
clj-json
"Elapsed time: 79.033905 msecs"
core.json
"Elapsed time: 638.59961 msecs"