Skip to content

Instantly share code, notes, and snippets.

View windytan's full-sized avatar
💭
I may be slow to respond.

Oona Räisänen windytan

💭
I may be slow to respond.
View GitHub Profile
while(not eof(STDIN)) {
read(STDIN,$a,2);
$a = unpack("s",$a);
print $a."\n";
}
@size = (1920, 1080);
@center = (-.743653135, .131826563);
$zoom = .000014628;
$max_it = 700;
$oversample = 2;
$_ *= $oversample for (@size);
open $fh, "|-", "convert -size ".join("x",@size)." -depth 8 gray:- ".
"-resize ".(100/$oversample)."% mandel.png";
for $py (1 .. $size[1]) {
@windytan
windytan / muta.pl
Created October 13, 2012 15:03
Evoluution simulointia sanoilla
use utf8;
use warnings;
@kirjaimet = ( "a" .. "z", "å", "ä", "ö" );
$alkutilanne = "aaaaaaaaaaaaaaa";
$valintapaine = "kehitysoppi";
# Elinkelpoisuutta simuloidaan ns. Levenšteinin etäisyydellä, joka sopii esimerkkiimme
use Text::Levenshtein qw(fastdistance);
@windytan
windytan / bitit.pl
Last active October 11, 2015 10:28
Perl script to read an image of digits
#!/usr/bin/perl
use feature "switch";
open(S,"convert bitit.png gray:-|");
for $y (0..434) {
for $x (0..699) {
read(S,$a,1);
$b[int($x / 27)][int($y / 27)] ++ if (ord($a) < 127);
}
}

Keybase proof

I hereby claim:

  • I am windytan on github.
  • I am oona (https://keybase.io/oona) on keybase.
  • I have a public key whose fingerprint is 5E58 B00C B427 8814 EE00 05ED 57BE DFA9 3BBB EDE8

To claim this, I am signing this object:

#include <openssl/sha.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main() {
const char target[SHA_DIGEST_LENGTH] = {
0x69, 0xaf, 0x88, 0x1e, 0xca, 0x98, 0xb7, 0x04, 0x2f, 0x18,
0xe9, 0x75, 0xe0, 0x0f, 0x9d, 0x49, 0xd5, 0xd5, 0xee, 0x64
};
@windytan
windytan / dark_cpan.pl
Created December 11, 2014 22:56
dark perldoc & CPAN
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document
domain('cpan.org')
{
html, body, tbody, tr, td, div { background-color: #232323 !important; color: #ccc !important }
pre {
display: block !important ;
background-color: #333333 !important ;
border: #777777 solid 0.1em !important ;
use warnings;
$fs = 48000;
$pi = 3.141592653589793;
open U, "|sox -t .raw -e sig -b 16 -c 1 -r $fs - numbers.wav sinc 300-4300";
dtmf ("12345567899000100100");
close U;
#!/usr/bin/perl
# Oona Räisänen 2014
use warnings;
$fs = 48000;
$f = 200;
$pi = 3.141592653589793238;
open(U,"|sox -t .raw -c 1 -r $fs -b 16 -e signed - sines.wav");
use warnings;
use DateTime;
$snum = 0;
$writing = 0;
open OUT, "|sox -t .raw -e unsigned-integer -b 16 -r 44100 ".
"-c 1 - stamped.wav";
while (not eof STDIN) {