Skip to content

Instantly share code, notes, and snippets.

View wilkie's full-sized avatar
☠️
screaming into the void

wilkie wilkie

☠️
screaming into the void
View GitHub Profile
@wilkie
wilkie / episode_renamer.pl
Created February 5, 2010 05:03
Will rename media files consisting of episodes of a television series by using the epguides.com website.
#!/usr/local/bin/perl
# AUTHORS: Dave Wilkinson and Bradley D. Kuhlman
# PURPOSE: Will rename media files consisting of episodes of a
# television series by using the epguides.com website from
# some cryptic, yet commonly found when downloaded on the
# internet, format to be `## - Title` where ## is the episode
# number.
#!/usr/local/bin/perl
# AUTHORS: Dave Wilkinson and Bradley D. Kuhlman
# PURPOSE: Will rename media files consisting of episodes of a
# television series by using the epguides.com website from
# some cryptic, yet commonly found when downloaded on the
# internet, format to be `## - Title` where ## is the episode
# number.
@wilkie
wilkie / gist:426976
Created June 5, 2010 20:42 — forked from anonymous/gist:426965
Getting a tuple of inherited classes with templates in D.
class A {
int bar;
}
class B : A {
int foo;
}
class C : B {
}
#!/usr/bin/perl
use strict;
use LWP::Simple;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use HTML::LinkExtor;
use HTML::Entities;
@wilkie
wilkie / base26.c
Created June 17, 2010 03:48 — forked from LindseyB/base26.c
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
char* toBase26(int num) {
char* str;
int length = 1;
int tmp = num;
@wilkie
wilkie / new.c
Created August 19, 2010 03:31 — forked from duckinator/new.c
#include <stdlib.h>
#include <stdio.h>
#define new(TYPE, ARGS...) ({\
TYPE *item = ( TYPE *)malloc(sizeof( TYPE )); \
item->init = &TYPE##Init; \
item->init(item, ARGS); \
item; \
})
@wilkie
wilkie / A.cpp
Created July 19, 2011 07:27
This shows the fallacy of a virtual function. (in C++, but same logic applies to D or C#)
#include <stdio.h>
// This is the implementation of the class
// The functions go in order a(), b(), then c()
// The constructor or compiler will build a vtable as [&a, &b, &c]
class A {
public:
A();
virtual void a() {
@wilkie
wilkie / whitespace.rb
Created September 18, 2011 01:10
Proof of concept trailing whitespace visualizer (idea by @jackiekircher)
module Whitespace
def self.trollify path, code
code.chomp!.gsub!(/([ \t]+)$/) do |match|
"; Whitespace::annoy(#{match.length})"
end
code.gsub!(/\brequire_relative\s*\(?\s*(.+?)\s*\)?;?$/) do |match|
"Whitespace::require_relative #{$1}, binding(), '#{path}'"
end
code
@wilkie
wilkie / Piratey.java
Created September 19, 2011 20:48
This is how pirates use Strings and void methods.
import java.util.Scanner;
import java.util.Random;
class Piratey {
public static void main(String args[]) {
String name;
Scanner input = new Scanner(System.in);
System.out.print("Enter in your first name: ");
@wilkie
wilkie / gist:1454348
Created December 10, 2011 02:35
Djehuty Layout
IO
- buffer
- stream
- file
- directory
- wavelet
- image
- audio
- socket