Skip to content

Instantly share code, notes, and snippets.

View thewestwind's full-sized avatar

David thewestwind

View GitHub Profile
@thewestwind
thewestwind / ua.pl
Created June 16, 2018 19:45
For use w/ lynx -useragent=xxx if you like.
#!/usr/bin/env perl
use strict;
use warnings;
use XML::Parser;
my @ua;
my $start = sub {
my(undef, $element, %attr) = @_;
@thewestwind
thewestwind / scale.sh
Created June 7, 2015 00:26
Some alpha-aware resizing script based on netpbm
#!/usr/bin/env bash
function usage() {
echo "USAGE: $0 < input.png > output.png" 1>&2
echo "USAGE: env gif=1 $0 < input.gif > output.png" 1>&2
exit -1
}
if tty < /dev/stdin >&/dev/null; then
usage
// This renders to some face; I'm using the output of a torus function
// as the input to a noise function... looks best at a 16:9 or 8:5
// aspect ratio
// Command line: povray hq.ini +IFace.pov
#version 3.62;
#include "Common.inc"
@thewestwind
thewestwind / Gensilence.asm
Created February 20, 2015 02:15
Creates a WAVE file which contains just silence. Woo.
;; Creates a WAVE file which contains just silence. Woo.
;;
;; Command line:
;;
;; nasm -f bin -o SILENCE.wav Gensilence.asm
%define DEFAULT_HZ 48000
%define DEFAULT_CHANNELS 2
%define DEFAULT_BITSPERSAMPLE 16
%define DEFAULT_DURATION 5 ;seconds
fps = 30
intro = AudioDub(ImageReader("intro.png", fps = fps, end = 5*fps-1), WAVSource("silence.wav"))
film = PointResize(ChangeFPS(DirectShowSource("dave_000.avi"), fps), 1280, 800)
result = Dissolve(intro, FadeOut(film, fps), fps)
result
#!/usr/bin/env bash
#
# This will create a bare Git repos "backed" by some Subversion
# subtree; uses the default trunk-tags-branches layout, for 1 user
# (line 51).
function usage {
echo "Usage: $(basename $0) <repos url> <repos.git>" 1>&2
exit -1
}
@thewestwind
thewestwind / eval.pl
Created January 22, 2015 00:55
Not much of a surprise...
#!/usr/bin/env perl
use strict;
use warnings;
# lynx -dump http://fabimc.tumblr.com/PremiumList | ./eval.pl
my %data;
while(<STDIN>) {
@thewestwind
thewestwind / toast.xml
Created January 20, 2015 15:45
Some example of Data::DumpXML output
<?xml version="1.0" encoding="US-ASCII"?>
<data xmlns="http://www.cpan.org/modules/by-authors/Gisle_Aas/Data-DumpXML-1.05.xsd">
<ref>
<array>
<ref>
<hash id="r1">
<key>bunch</key>
<ref>
<hash>
<key>Data/DumpXML.pm</key>
@thewestwind
thewestwind / bfc.cpp
Created January 15, 2015 14:30
Just some Brainfuck compiler (LLVM based)
#include "headers.h"
using namespace llvm;
using namespace std;
struct codegen {
enum insn_name {
ptr_increment, // >
ptr_decrement, // <
value_increment, // +
@thewestwind
thewestwind / woo.c
Created January 14, 2015 02:33
Woo.
/*-----------------------------------------------------------*/
/*--- W ytjuq-mhrjdvf, rolsuluc pjlunpzcwl vejp6.c ---*/
/*-----------------------------------------------------------*/
/* ------------------------------------------------------------------
Qers bhzq rh ijrd sf zejj6/tltjxrn5, y rspsagj kij ggdclgo ygb
cdnlnbea, hwotv-cswmgjb hisa rdpjgepgakq.
kupg8/wpbksvh5 pblodyo 4.0.1 vp 8 Sebsebumo 3834
Ebjvfxujk (M) 0252-4682 Myyomg Dqiyua <[email protected]>