Skip to content

Instantly share code, notes, and snippets.

@niko
niko / README.md
Last active August 7, 2019 21:43
i3wm & mutt: check mails, blink caps lock led, mark mail workspace as urgent.

This puzzle has 3 parts:

  • A i3wm config that opens mutt in a dedicated workspace. $mod+m will switch to this workspace and will launch mutt, if not already running. Actually it doesn't launch mutt, but…
  • a small wrapper script, which opens a named pipe and then starts mutt.
  • a checkmail script which uses mailcheck(1) to tara check mail. If new mail is available, it blinks the CAPS LOCK led (which I mapped to CTRL anyway) and marks the mutt workspace via a bell.

Additional configuration:

  • set your terminal to mark urgent bells. In Termite the setting is "urgent_on_bell = true".
  • adopt you ~/.mailcheckrc to include paths to your mailboxes. In the simplest case it contains just the line "$(HOME)/Maildir/INBOX"
@niko
niko / rename.sh
Last active December 14, 2015 16:08
#!/bin/bash
# Batch renaming files via your sharpest tool - your text editor.
# Given a file pattern as argument renamer.sh opens $EDITOR
# with the selected files. Rename them in the editor, save
# and quit. You will be presented with the rename script
# so you can inspect what will happen when you continue.
# renamer.sh will do the renaming in two steps. First all
# files will be renamed to temporary names with increasing
# IDs. Then the renaming to the final name will be done.
function greparate() {
PATTERN=$1;
FILENAME=$2;
FILENAME_WITH=`echo $FILENAME | sed "s/\.\([^\.]*\)$/.with_$PATTERN.\1/"`;
FILENAME_WITHOUT=`echo $FILENAME | sed "s/\.\([^\.]*\)$/.without_$PATTERN.\1/"`;
echo "Seprating the content of $FILENAME by $PATTERN into $FILENAME_WITH and $FILENAME_WITHOUT"
grep $PATTERN $FILENAME > $FILENAME_WITH;
grep -v $PATTERN $FILENAME > $FILENAME_WITHOUT;