Skip to content

Instantly share code, notes, and snippets.

View ralt's full-sized avatar

Florian Margaine ralt

View GitHub Profile
;;;; -*- Mode: Lisp -*-
(in-package :stumpwm)
(ql:quickload 'swank)
(ql:quickload :alexandria)
(swank-loader:init)
(defcommand swank () ()
(setf stumpwm:*top-level-error-action* :break)
(swank:create-server :port 4004
@ralt
ralt / stumpwmrc.lisp
Created August 18, 2015 13:03
stumpwm alert-me-at
(ql:quickload :bordeaux-threads)
(defcommand alert-me-at (alert-hour alert-minute message) ((:number "hour: ") (:number "minute: ") (:string "message: "))
"Alert me at some point in time. Doesn't handle time too early, so the thread will go on forever."
(bordeaux-threads:make-thread
#'(lambda ()
(loop
do (sleep 5)
when (multiple-value-bind (seconds minute hour)
(get-decoded-time)
@ralt
ralt / install.sh
Last active August 29, 2015 14:28
Quicklisp Global Install (aka the road to a real debian package). Replace + with / in filenames.
sudo sbcl --load quicklisp.lisp --eval '(quicklisp-quickstart:install :path #p"/usr/share/quicklisp/quicklisp")'
# Maybe put the /usr/share/quicklisp/ folder straight in the package.
# quicklisp is downloaded in /usr/share/quicklisp/quicklisp so that /usr/share/quicklisp is available
# for other files, such as the helpers for quickloading global systems.
# The quicklisp.lisp file should be in /usr/share/quicklisp/, so that it's reusable
# for local installs. See /usr/bin/ql-local-install
/*
The service, run as root, will listen on the /var/run/hermes.sock
socket. The only command it will understand is a four-bytes long
command, being a number mapping an action.
Really, only one action is needed: get me the content of the
connected hermes device. Having 4 bytes is cheap enough, and leaves
other possibilities later on, if needed.
The "get me the content" command needs the value "1". It can return
module.exports = {
io: null,
socket: null,
createReactiveMethod: function() {},
initialize: function(server) {
console.log("initialized!");
this.io = require('socket.io').listen(server);
var that = this;
@ralt
ralt / x.js
Created May 29, 2012 17:22 — forked from Raynos/x.js
var UserCollection = require("../dataSources/user")
var User = {
find: function( name, skypeName, callback ) {
if ( skypeName ) {
findBySkypeName( name, callback );
}
// The rest of your logic there
}
}
// Assume errorPage, jsonBody, formBody exist within scope.
function methods(routes, handleHttpForms) {
if (handleHttpForms) {
return createHttpFormsRequestHandler(routes)
}
return requestHandler.bind(this)
}
function requestHandler(req, res) {
@ralt
ralt / shitanal.js
Created June 28, 2012 14:40
A little script that will screw up people using campaigns on Google Analytics
/**
* A little script that will screw up people using campaigns on Google
* Analytics.
*
* Do. Not. Use.
*
* I am not responsible for any action that people may employ using this
* little script. It was done purely out of curiosity.
*
* Usage:
@ralt
ralt / app.js
Created July 13, 2012 14:12
Trying to understand ncore...
var ncore = require( 'ncore' );
ncore.constructor( {
"./other.js": {
"test": "./test.js"
}
});
console.log( ncore );
@ralt
ralt / jquery-second-click.js
Created September 28, 2012 19:13 — forked from ryankinal/jquery-second-click.js
jQuery "second click" plugin
// Untested, off-the-cuff
$.fn.secondClick = function(handler)
{
if ( !$( this ).data( 'click' ) ) {
$( this ).data( 'click', 1 );
}
else if ( $( this ).data( 'click' ) === 1 ) {
handler();
$( this ).data( 'click', '' );
}