This file contains hidden or 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/python | |
| import cv2 | |
| import numpy as np | |
| import wave | |
| import struct | |
| import sys | |
| # usage instructions: | |
| # ./image2spectrogram.py input.png |
This file contains hidden or 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/env perl | |
| # 14-px Braille bitmap font compatible with Terminus. | |
| # klg, Oct 2014 | |
| use strict; | |
| use List::MoreUtils 'pairwise'; | |
| use constant XLFD => '-klg-TBraille-Medium-R-Normal--14-140-72-72-C-80-ISO10646-1'; | |
| use constant BBX => (8, 14, 0, -2); | |
| my %properties = do { |
This file contains hidden or 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/env perl | |
| # Change modification time stored in GZIP file. | |
| # klg, Oct 2014 | |
| use strict; | |
| use open IN => ':bytes'; | |
| use Time::Local; | |
| use constant GZIP_ID => 0x8b1f; | |
| use constant FLG_FHCRC => (1 << 1); |
This file contains hidden or 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/env perl | |
| # Extract deflated first member from PKWARE ZIP as GZIP. | |
| # klg, Feb, Oct 2014 | |
| use strict; | |
| use constant { | |
| ZIP_FILE => 0x04034b50, | |
| GZIP_MAGIC => 0x8b1f, | |
| CM_DEFLATE => 8, | |
| }; |
This file contains hidden or 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/env perl | |
| # Compare Debian versions; faster than Dpkg::Version. Probably pointless. | |
| # klg, Nov 2014 | |
| use strict; | |
| do { | |
| my $ver_split = sub { | |
| shift =~ m/^ | |
| (?|([0-9]+):([0-9a-z.+:~-]+)-([0-9a-z+.~]+) |
This file contains hidden or 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
| #!/bin/sh | |
| # List packages not available in remote repositories. | |
| # klg, Dec 2014 | |
| set -e | |
| if [ -n "$1" -a '/-a' != "/$1" ] | |
| then | |
| echo >&2 "Usage: $0 [-a]" | |
| exit 1 | |
| fi |
This file contains hidden or 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
| // — ⁂ — | |
| hr { | |
| height: 0; width: 100%; | |
| margin: $line-height 0; | |
| border: 0; padding: 0; | |
| color: inherit; // Firefox | |
| text-align: center; | |
| line-height: 0; | |
| cursor: default; | |
| overflow: visible; // IE |
This file contains hidden or 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/env perl | |
| # Examine DEFLATE streams. | |
| # klg, Jan 2015 | |
| use strict; | |
| use open IN => ':bytes'; | |
| #### Containers ############################################################### | |
| sub extract_zlib { # RFC 1950 |
This file contains hidden or 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
| package main | |
| // -- From RFC 3280 PKIX: | |
| // | |
| // SubjectPublicKeyInfo ::= SEQUENCE { | |
| // algorithm AlgorithmIdentifier, | |
| // subjectPublicKey BIT STRING } | |
| // | |
| // AlgorithmIdentifier ::= SEQUENCE { | |
| // algorithm OBJECT IDENTIFIER, |
This file contains hidden or 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
| %!PS | |
| % klg, Mar 2015 | |
| %%BoundingBox: 0 123 595 718 | |
| /primes { % n primes array | |
| 3 sub 2 idiv array | |
| % sieve | |
| dup length 1 sub | |
| 0 1 3 -1 roll { | |
| 2 copy get |