Skip to content

Instantly share code, notes, and snippets.

View kunta2021.py
import pandas as pd
hs_poll_perc = {
'kok': 19.6,
'ps': 18.0,
'sdp': 17.9,
'kesk': 12.7,
'vihr': 11.1,
'vas': 8.2,
'rkp': 4.6,
View geom_model.py
import numpy as np
import matplotlib.pyplot as plt
def compensatory_radius(estimate_dispersion, R):
cosarg = estimate_dispersion/R**2
# Cos will go negative when arg > pi/2. arg < 0 makes no sense, so no need to worry about that.
# Trigonometry breaks down for this at pi/2? Could probably have some sort of analytical
# continuation if needed, however pi/2 dispersion leading to center seems implausible for a
# model.
r_2 = R*np.cos(cosarg)
View gist:61685ec5a0d8180f5ad54de937335283
Loppuiko historian loppu:
Historian loppuun (1992)
Lätkän MM-kultaan (1995)
Sokalin tapaus (1996)
Dot-com-romahdukseen (1995)
Dianan kuolema (1997)
WTO-iskuihin (1999)
WTC-iskuihin (2001)
Pentagon-iskuihin (2001)
View uvccap.cpp
#include <opencv2/opencv.hpp>
#include <string>
using namespace cv;
int main(int argc, char **argv) {
int camno = 0;
if(argc > 2) {
camno = std::atoi(argv[1]);
}
View gstabstime.c
/*
* GStreamer
* Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net>
* Copyright (C) 2017 Jami Pekkanen <jami.pekkanen@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
@jampekka
jampekka / activity.py
Created Apr 2, 2017
/r/place activity animated heatmap
View activity.py
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
import pyximport; pyximport.install()
from pixcount import pixcount
import scipy.ndimage
data = np.load('diffs.npy')
ts = data[:,0]
frames = 1000
View sigsync.py
import numpy as np
import scipy.interpolate
import scipy.signal
def match_sampled_brutal(ts1, haystack, ts2, needle, minlen=100):
dt = np.median(np.diff(ts1))
ts1_base = ts1[0]
ts1 = ts1 - ts1_base
View projectstuff.py
def project_to_ground(pos, camera, height=0.0):
matWorldInverse = np.array(camera['matrixWorldInverse']).reshape(4, 4).T
matWorld = np.linalg.inv(matWorldInverse)
proj = np.array(camera['projectionMatrix']).reshape(4, 4).T
origin = matWorld[:,3][:-1]
deproj = np.dot(matWorld, np.linalg.inv(proj))
direction = np.dot(deproj, (pos[0], pos[1], 0.5, 1.0))
direction = direction[:-1]/direction[-1]
direction -= origin
View enginemodel.json
[[-19.150852756939567, -0.86960922500437798], [-10.0, -0.67314024428906383], [-4.0, -0.53092823365752206], [-2.5, -0.34978573520149692], [-1.7, -0.097415037510977784], [-1.2, 0.031117285095661945], [0.0, 0.26398121786496032], [3.0, 0.71245888265216406], [5.2096257357368652, 0.93516331581155065]]