Skip to content

Instantly share code, notes, and snippets.

@monomon
monomon / timestampfiles.sh
Last active Oct 26, 2017
Script to timestamp files with their last modification date, optionally adding a counter
View timestampfiles.sh
#!/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 / String.prototype.template.js
Created Oct 3, 2015 — forked from WebReflection/String.prototype.template.js
ES6 Template like strings in ES3 compatible syntax.
View String.prototype.template.js
// 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,
View scribus_catalog.py
# -*- 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 / jack_start
Created Jul 19, 2014
jack detect card from aplay and start
View jack_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
You can’t perform that action at this time.