Skip to content

Instantly share code, notes, and snippets.

@monomon
monomon / jack_start
Created July 19, 2014 13:17
jack detect card from aplay and start
#!/bin/sh
timeout=6
#card=3,0
# query card number from aplay
card=`aplay -l | sed -n '/Komplete/s/card\ \([0-9]\).*device \([0-9]\).*/hw:\1,\2/p'`
if [ -z $card ]
then
echo "Komplete card not found"
exit
@monomon
monomon / scribus_catalog.py
Last active August 29, 2015 14:05
Scribus scripts
# -*- coding: utf-8 -*-
'''
Create a catalog of articles
As a rule I finish the layout with some hand touches, but the bulk of it is generated.
For each article display name, description, photo.
Layout articles in two columns on the page.
Articles are grouped by category and each category begins on a new page.
Find a finished example at http://monomon.me/stuff/mmcosmetics/mm_catalog.pdf
@monomon
monomon / String.prototype.template.js
Created October 3, 2015 00:14 — forked from WebReflection/String.prototype.template.js
ES6 Template like strings in ES3 compatible syntax.
// accepts optional transformer
// now transformers are compatible with ES6
String.prototype.template = function (fn, object) {'use strict';
// Andrea Giammarchi - WTFPL License
var
hasTransformer = typeof fn === 'function',
stringify = JSON.stringify,
re = /\$\{([\S\s]*?)\}/g,
strings = [],
values = hasTransformer ? [] : strings,
@monomon
monomon / timestampfiles.sh
Last active October 26, 2017 08:49
Script to timestamp files with their last modification date, optionally adding a counter
#!/bin/bash
# timestamp passed files
# by inserting the date into the filename
#
# The linux `rename` command is great, but it doesn't allow
# inserting a consecutive counter into the filename
# if there is a conflict.
#
# Also, there is the amazing Thunar Bulk Rename tool,
@monomon
monomon / simple-file-server.lisp
Created January 27, 2022 21:11
Simple hunchentoot server with file form and post handler for the file
(define-easy-handler (submission-form :uri "/" :default-request-type :get) ()
(setf (hunchentoot:content-type*) "text/html")
(with-html-output-to-string (s)
(:html
(:head
(:title "File Processor")
(:style :rel "stylesheet" :type "text/css"
(str (css-lite:css (("body") (:background-color "#666"))))))
(:body
(:form :action "/process"