Skip to content

Instantly share code, notes, and snippets.

View toroidal-code's full-sized avatar

Katherine Whitlock toroidal-code

  • New York
View GitHub Profile
@toroidal-code
toroidal-code / Hyper.md
Last active December 31, 2023 19:32
Have you a Hyper for Great Good

Have you Hyper for Great Good

So. You have become an Emacs wizard. And you find yourself aching for the simplicity that another modifier key would introduce into your life. Ah, the things you could do with Hyper.

Or maybe, you just want Hyper for another reason.

... Except everywhere you look, everyone's talking about .xmodmaps and xkbcomp, but you're using one of those fancy desktop managers. (Aka, not awesome, dwm, xmonad or something even more hipster) And because of that, you're lost in the sea of confusion that is trying to customize your keyboard mapping.

Gnome, Cinnamon, and KDE all use xkb.

@toroidal-code
toroidal-code / pacat.c
Created February 4, 2014 05:54
PulseAudio example with callbacks
/***
This file is part of PulseAudio.
Copyright 2004-2006 Lennart Poettering
Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
#! /usr/bin/env python2
from PyZ3950 import zoom # ZOOM is the protocol
from pymarc import MARCReader # This is for easily dealing with USMARC data
from pyx import * # This is for exporting EPS/PDF
import os # for calling lpr
unit.set(xscale=1.5) # Text scale for pyx
conn = zoom.Connection('z3950.loc.gov', 7090) # Which server to connect to with ZOOM #albert.rit.edu, 210
conn.databaseName = 'VOYAGER' # Which database to use #innopac
;; A small self applicable scheme->llvm compiler.
;; , Tobias Nurmiranta
;;
;; -- To Use It --
;; Reads scheme-code from standard input.
;; cat code.ss|mzscheme --script compile.ss|llvm-as -f -o=test.bc;lli test.bc
;;
;; The compiler is painfully slow since it for testing purposes
;; compiles all help functions as well (see variable bootstrap).
;; It extends standard scheme with a subset of available
### Makefile ---
##
## Filename: Makefile
## Description: A generic C Makefile
## Author: Katherine Whitlock - toroidalcode
## Created: Tue Jun 24 17:45:43 2014 (-0400)
## Version: 0.1
######################################################################
##
### Code:
function rand(min, max) {
return parseInt(Math.random() * (max-min+1), 10) + min;
}
function get_random_color() {
var h = rand(1, 360); // color hue between 1 and 360
var s = 58; // saturation 30-100%
var l = 32; // lightness 30-70%
return 'hsl(' + h + ',' + s + '%,' + l + '%)';
}
#!/usr/bin/env ruby
require 'highline/import'
require 'colorize'
l_tag_regex = /(^\[[\w-]+\]\s*|_-_THORA\s*)/ #/^\[[\w-]+\]\s*/ #Remove sub group tag. THORA gets a special case
t_tag_regex = /\s*\[\w{8}\]$/ # match [A71160AA]-formatted trailing tags (CRC32)
e_tag_regex = /((\[|\()(?!\d{4}\)).*?(\]|\)))/ # Don't match (year), but match [1080p,etc.] or (1080p, etc.);
# will also exclude match of [year) #TODO: Fix this
class Rename
require 'nokogiri'
require 'open-uri'
def next_node_with(current, attribute, cond)
while current && current.send(attribute) != cond
current = current.next
end
current
require 'octokit'
require 'colorize'
print 'GitHub username: '
username = $stdin.gets.strip
repos = Octokit.repos(username, {type: 'public'}).map { |repo| repo['full_name'] }
puts 'Searching for license files...'
extern crate sync;
use sync::mutex::{Mutex,Guard};
use std::task;
fn lock<'a>(l0 : &'a Mutex, l1 : &'a Mutex) -> (Guard<'a>, Guard<'a>) {
loop {
't0: for _ in range(0u, 1u) {
let u0 = l0.lock();
let u1 = match l1.try_lock() {
None => {