Skip to content

Instantly share code, notes, and snippets.

View jashank's full-sized avatar

Jashank Jeremy jashank

View GitHub Profile
@jashank
jashank / jekyll-kramtoc.rb
Created February 12, 2014 03:25
Kramdown TOC->HTML wrapped in Jekyll
require 'kramdown'
module Jekyll
module Converters
class Markdown
class KramdownParser
attr_accessor :kramdown
DISPATCHER = Hash.new {|h,k| h[k] = "convert_#{k}"}
### grub configuration for alyzon
#
# I run FreeBSD/amd64 with root-on-ZFS on a Lenovo ThinkCentre M83,
# which has UEFI. At the moment, this configuration is basically
# unsupported (although it's coming soon), but I want to be able to
# use my system. I've had prior experience with Lenovo UEFI boxes
# before (Arch on my ThinkPad T440), and I hate autogenerated GRUB
# configs, so I appropriated my hand-written GRUB config, and extended
# it.
#
@jashank
jashank / jove.pl
Created April 12, 2012 00:50
Planet Jupiter receiver
#!/opt/local/bin/perl -w
# jove -- listen to jupiter
#
# We get a constant 1ch s16le bitstream on <STDIN>. Not
# optimal, I know. We are constantly reading from the
# bitstream, in one of two modes:
# - in SLAB mode, the samples are then preserved, processed and
# dumped to outputs (logfile, slabfile, slabstat, quadfile).
# - in NOTSLAB mode, the samples are ignored. This also gives
# us some processing headroom.
@jashank
jashank / BinderItem.pm
Created June 24, 2012 03:50
Converting collection to individual
has 'Title' => (
isa => 'Scrivener::Title',
is => 'ro',
traits => [qw(XML)],
lazy => 1,
description => {
LocalName => "Title",
Prefix => "",
node_type => "child",
Name => "Title",
@jashank
jashank / .htaccess
Created July 11, 2012 07:36
Apache config
Options +FollowSymLinks
AddHandler cgi-script .cgi
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ dispatch.cgi?/$1 [QSA,L]
# nicked from gportal, patched for Tingle
@jashank
jashank / spoons.rb
Created August 9, 2012 02:21
Nonsense values for selected_line
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'plist'
require 'curses'
#require 'mplayer'
class Library
def initialize()
@jashank
jashank / prefixdemo.pl
Created October 6, 2012 01:10
Dancer prefix bug: only the first of a set of side-by-side prefixes is accessible
#!/usr/bin/perl -w
use Dancer;
prefix '/a' => sub {
prefix '/b' => sub {
get '/foo' => sub { "Hello!" };
get '/bar' => sub { "Goodbye!" };
};
@jashank
jashank / dancer2test.pl
Created March 12, 2013 07:10
Dancer2::Test misbehaviour
#!/usr/bin/perl -w
use warnings;
use strict;
=head1 NAME
dancer2test.pl -- test code for Dancer2::Test
=head1 SYNOPSIS
@jashank
jashank / gist:5179273
Created March 17, 2013 02:23
Ruby SDL playback (as used in CMG)
# I initialise on L19-22
# let $SAMPLERATE be 48000; I'd like to do this more dynamically, eventually
SDL.init(SDL::INIT_AUDIO)
SDL::Mixer.open($SAMPLERATE, SDL::Mixer::DEFAULT_FORMAT, 2, 8192)
SDL::Mixer.allocate_channels(128)
# Inside the class Channel, I play audio on L68 (cherrypicking salient lines).
# Typically, there exist 64 Channels.
class Channel
attr_accessor :sdl, :num
@jashank
jashank / Makefile
Created June 26, 2013 23:20
GNU make is broken
PROJECT = foo
include project.mk