This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(not eof(STDIN)) { | |
read(STDIN,$a,2); | |
$a = unpack("s",$a); | |
print $a."\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use constant BPS => 300; | |
use constant SRATE => 44100; | |
$dur = 0; | |
for (qx!cat olddata.asc!) { | |
chomp($a = $_); | |
if ($a * $preva < 0) { | |
$nbits = int($dur / (SRATE/BPS) + .5); | |
print ((($preva < 0) ? 1 : 0) x $nbits); | |
$dur = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$prevbit = 0; | |
$n=0; | |
for (qx!cat ddtaa.asc!) { | |
chomp($a = $_); | |
if ($n >= 2300) { | |
if (($n - 2300) % 80 == 0) { | |
$bit = ($a > 0) ? 1 : 0; | |
print (($bit != $prevbit) ? "1" : "0"); | |
$prevbit = $bit; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open(S,"sox salakalastaja.wav -t .raw -e signed -|"); | |
open(U,"|sox -b 16 -c 1 -e signed -t .raw -r 44100 ". | |
"- ssb.wav sinc 6000 -n 4096"); | |
while(not eof(S)) { | |
read(S,$a,2); | |
print U pack("s",unpack("s",$a) * | |
cos(($n++ * 2 * 3.141592653589793 * 6000) / 44100); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$|++; | |
use warnings; | |
use Text::LevenshteinXS qw(distance); | |
for (qx!cat nappis.txt!) { | |
$merkki{$2} = $1 if (/^(.+) ([01]+)/); | |
} | |
while (<>) { | |
chomp(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use warnings; | |
use Getopt::Std; | |
getopt('xytGgwsf',\%opts); | |
# pcm file = $opts{f} | |
# samples per pixel x | |
$xscale = $opts{x} // 1200; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open(IN, "sox scrambled.wav -r 8600 -c 1 -t .s16 -|"); | |
open(OUT,"|sox -r 8600 -c 1 -t .s16 - descrambled.wav"); | |
$n = 1; | |
while (not eof IN) { | |
read IN, $a, 2; | |
print OUT pack("s",unpack("s",$a) * $n); | |
$n *= -1; | |
} |
OlderNewer