Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Oona Räisänen windytan

💭
I may be slow to respond.
View GitHub Profile
View oscillo.pl
use warnings;
use Getopt::Std;
getopt('xytGgwsf',\%opts);
# pcm file = $opts{f}
# samples per pixel x
$xscale = $opts{x} // 1200;
@windytan
windytan / plot_rpm.pl
Created Apr 15, 2020
Plot the amplitude in an audio file as a grayscale image
View plot_rpm.pl
#!/usr/bin/perl
use strict;
use warnings;
# Perl script to plot the amplitude in an audio file as a grayscale image.
# Uses SoX and ImageMagick via shell.
#
# Note that the height of the image is only limited by the length of the
# audio file.
View fsk-timestamp.pl
use warnings;
use DateTime;
$snum = 0;
$writing = 0;
open OUT, "|sox -t .raw -e signed-integer -b 16 -r 44100 ".
"-c 1 - stamped.wav";
while (not eof STDIN) {
View deco.pl
$|++;
use warnings;
use Text::LevenshteinXS qw(distance);
for (qx!cat nappis.txt!) {
$merkki{$2} = $1 if (/^(.+) ([01]+)/);
}
while (<>) {
chomp();
View fm.c
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <fftw3.h>
#define FFTLEN 2048
#define SRATE 22050
// Return sinusoid power from complex DFT coefficients
double power (fftw_complex coeff) {
@windytan
windytan / emoji.pl
Last active Feb 18, 2019
Visualize SSH public key fingerprints using Unicode emoji
View emoji.pl
# Oona Räisänen 2013
# http://windytan.com
# ssh-keygen -l -f ~/.ssh/id_rsa.pub | perl emoji.pl
@emoji = qw( 🌀 🌂 🌅 🌈 🌙 🌞 🌟 🌠 🌰 🌱 🌲 🌳 🌴 🌵 🌷 🌸
🌹 🌺 🌻 🌼 🌽 🌾 🌿 🍀 🍁 🍂 🍃 🍄 🍅 🍆 🍇 🍈
🍉 🍊 🍋 🍌 🍍 🍎 🍏 🍐 🍑 🍒 🍓 🍔 🍕 🍖 🍗 🍘
🍜 🍝 🍞 🍟 🍠 🍡 🍢 🍣 🍤 🍥 🍦 🍧 🍨 🍩 🍪 🍫
🍬 🍭 🍮 🍯 🍰 🍱 🍲 🍳 🍴 🍵 🍶 🍷 🍸 🍹 🍺 🍻
View fake_3D_wave.pl
use warnings;
my $width = 1000;
my $height = 500;
my $n_pts = 1000;
my $wavelength = 9;
print '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" '.
'width="'.$width.'" height="'.$height.'">'."\n";
@windytan
windytan / infini-cat.sh
Created Nov 18, 2018
Infini-cat: Output a file to stdout in an infinite loop
View infini-cat.sh
#!/bin/sh
while true; do cat $1; done
@windytan
windytan / markov-tavut.pl
Last active Oct 24, 2017
Markov-ketjuilla uusia sanoja suomenkielisestä lähdetekstistä
View markov-tavut.pl
#!/usr/bin/perl
#
# Markov-tavutin
#
# (c) Oona Räisänen
# MIT license
#
use strict;
use warnings;
View stackedplot.pl
#!/usr/bin/perl
# windytan 2017, public domain
use warnings;
use strict;
my $img_width = 1200;
my $img_height = 900;
my $yscale = 0.6;
my $xscale = 0.13;
my $rowheight = 5;