Skip to content

Instantly share code, notes, and snippets.

Adam R. Nelson ar-nelson

Block or report user

Report or block ar-nelson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ar-nelson
ar-nelson / SIP.hs
Last active Aug 29, 2015
SIP hash in pure Haskell
View SIP.hs
{-# LANGUAGE UnicodeSyntax #-}
-- SIP hash in pure Haskell
-- Original C reference implementation taken from (github.com/veorq/SipHash)
-- Translated to Haskell by Adam R. Nelson (github.com/ar-nelson)
--------------------------------------------------------------------------------
module Data.Digest.SIP(sipHash) where
import Control.Monad
@ar-nelson
ar-nelson / wmiirc.1.sh
Created Sep 14, 2013
Initial version of the launcher script for wmiirc.js.
View wmiirc.1.sh
#!/bin/sh
node ~/.wmii-hg/wmiirc.js
@ar-nelson
ar-nelson / wmiirc.1.js
Created Sep 14, 2013
Initial skeleton version of wmiirc.js, the user-modifiable configuration file for my node.js wmii config.
View wmiirc.1.js
var dialog = require('./lib/dialog.js');
var wmii = require('./lib/wmii.js');
var wmiir = require('./lib/wmiir.js');
var modkey = 'Mod4';
var terminal = 'urxvt';
function attachModKey(mode) {
var newMode = {};
for (var key in mode) {
@ar-nelson
ar-nelson / wmii.1.js
Created Sep 14, 2013
Initial skeleton version of the core wmii config node.js module.
View wmii.1.js
// wmii core Module
// Adam R. Nelson
// August 2013
var wmiir = require('./wmiir.js');
var events = require('./wmii_events.js');
var keys = require('./wmii_keys.js');
var dialog = require('./dialog.js');
var spawn = require('child_process').spawn;
@ar-nelson
ar-nelson / dialog.js
Created Aug 30, 2013
node.js module that displays Zenity dialog boxes.
View dialog.js
// zenity dialog box functions
// Adam R. Nelson
// August 2013
var spawn = require('child_process').spawn;
function appendSettings(args, settings) {
if (settings) {
if (settings.ok) {
args.push('--ok-label');
@ar-nelson
ar-nelson / wmii_keys.js
Last active Dec 21, 2015
wmii keyboard events handler for node.js. Depends on wmiir.js and wmii_events.js.
View wmii_keys.js
// wmii keybindings and keyboard event module
// Adam R. Nelson
// August 2013
var wmiir = require('./wmiir.js');
var events = require('./wmii_events.js');
var globalKeys = {};
var modeKeys = {};
var currentMode = null;
@ar-nelson
ar-nelson / key_events.js
Created Aug 24, 2013
Uses wmii_events.js to listen for wmii keypress events.
View key_events.js
var events = require('./wmii_events.js');
var stdin = process.openStdin();
events.on('Key', function(key) {
console.log('Keypress: ' + key);
});
console.log("Press ENTER to exit.");
stdin.on('data', function(data) {
@ar-nelson
ar-nelson / wmii_events.js
Last active Dec 21, 2015
node.js EventEmitter wrapper for the wmii event loop.
View wmii_events.js
// wmii event handler module
// Adam R. Nelson
// August 2013
var events = require('events');
var util = require('util');
var wmiir = require('./wmiir.js');
function WmiiEvents() {
View hello.js
console.log('Hello, world!');
@ar-nelson
ar-nelson / event_reader.js
Created Aug 24, 2013
Simple node.js script that prints wmii events as they occur.
View event_reader.js
var spawn = require('child_process').spawn;
var stdin = process.openStdin();
var reader = spawn('wmiir', ['read', '/event']);
reader.stdout.on('data', function(data) {
console.log("Got event: " + data);
});
console.log("Press ENTER to exit.");
You can’t perform that action at this time.