Skip to content

Instantly share code, notes, and snippets.

View jampekka's full-sized avatar

Jami Pekkanen jampekka

View GitHub Profile
@jampekka
jampekka / facade_poc.js
Created March 23, 2024 16:36
node-web-audio-api facade binding
// Wraps GainNode and OscillatorNode using JS-only class hierarchy
// Requiring needed internal things. Done from the "outside", so very ugly.
const napiBinding = require('./node_modules/node-web-audio-api/node-web-audio-api.linux-x64-gnu.node')
const {
throwSanitizedError,
} = require('./node_modules/node-web-audio-api/js/lib/errors.js');
const {
@jampekka
jampekka / löylymittari.txt
Created November 4, 2023 22:49
Sauna steam meter/löylymittari
This document is to establish prior art on a method and apparatus to measure estimates of subjective sauna steam (löyly) effects in real time or from a recorded log.
There's no intent to patent or otherwise restrict the use of this invention. The purpose is to allow free use and further development of the idea, invention and/or apparatus to anybody for any purpose.
Subjective effects of sauna steam (löyly) are quantified by a transformation of instantaneous temperature, moisture and optionally air pressure with a mathematical or computational formulation. These can be based on for example existing "heat indices" commonly used to quantify the feel of the weather. In implementations these have been recorded with commercial temperature, moisture and pressure sensors
The measurements are combined with a computer program for quantifications of the subjective effects. This estimate can be presented in various formats. Numerical display and light color modulation have been implemented
Furthermore, the progressio
@jampekka
jampekka / kansainvalinen.txt
Last active April 30, 2023 10:09
Kansainvälinen sanat ja soinnut (chords)
G C
Työn orjat, sorron yöstä nouskaa,
Am D7 G D7
maan ääriin kuuluu kutsumus.
G C
Nyt ryskyin murtuu pakkovalta,
D7 G
tää on viime ponnistus.
D A D
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 31 columns, instead of 1. in line 4.
oppilaitostyyppi_nimi,oppilaitosnumero,on_alt,oppilaitoksen_nimi,oppilaitostyyppi,postinumeroalue,postinumeroalue_nimi,kunta,asukkaat_yht,koulutus_kantaluku,koulutus_alempi_kork,koulutus_ylempi_kork,asukkaiden_mediaanitulo,tyollisyys_tyolliset,suomen_kieli_ja_kirjallisuus,suomi_toisena_kielena_ja_kirjallisuus,suomi_s2_osuus,ruotsin_kieli_ja_kirjallisuus,ruotsi_toisena_kielena_ja_kirjallisuus,ruotsi_s2_osuus,oppilaita_yhteensa,oppilaat_opla,erotus,kunta_nimi,maakunta,maakunta_nimi,kieli,tyollisyys_18_74,ka_pitka,keskiarvo,luokat
Peruskoulut,08871,8871,Aapiskujan koulu,11,62800,Vimpeli Keskus,934,2155,1770,166,104,20781,839,111,,0,,,0,111,158,47,Vimpeli,14,Etelä-Pohjanmaa,1,1478,,0,1–4
Peruskoulut,03117,3117,Aarnivalkean koulu,11,02100,Tapiola,049,6025,5291,907,1928,30435,2846,270,33,11,,,0,303,296,−7,Espoo,01,Uusimaa,1,4455,,0,1–6
Peruskouluasteen erityiskoulut,03874,3874,Aavan koulu,12,12380,Leppäkoski,165,493,386,40,18,23916,222,12,,0,,,0,12,22,10,Janakkala,05,Kanta-Häme,1,342,"6,591911765","6,59",4–9
Perusk
@jampekka
jampekka / mind.py
Last active November 4, 2021 09:40
Simple The Mind type game
import random
import selectors
import sys
total_cards = 100
cards_per_player = 3
deck = list(range(1, total_cards + 1))
random.shuffle(deck)
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,
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)
@jampekka
jampekka / gist:61685ec5a0d8180f5ad54de937335283
Last active May 27, 2021 16:28
Historian lopun havinat
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)
#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]);
}
/*
* 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.
*