Skip to content

Instantly share code, notes, and snippets.

@alexfouche
alexfouche / pandoc_docker
Last active January 5, 2020 12:42
Run Pandoc from docker image
#!/bin/bash
# First parameter must be file name to convert
where=`dirname "$1"`
what=`basename "$1"`
shift
pushd "$where" >/dev/null
docker run --rm --volume "$where:/data" --user `id -u`:`id -g` pandoc/core "$what" "$@"
popd >/dev/null
@alexfouche
alexfouche / watchloop
Last active January 4, 2020 19:22
Run a command every X seconds. Differs from `watch` because it does not clear the screen at each command run
#!/bin/bash
# NOTE: This requires GNU getopt. On Mac OS X and FreeBSD, you have to install this
# separately; see below.
OPTS=`getopt -o hn: --long help,interval: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
# echo "$OPTS"
@alexfouche
alexfouche / transfer_maildir_to_folders
Created January 4, 2020 19:03
Import all the messages from many mailboxes (also the ones in subfolders) into one maildir mailbox, into named folders
#!perl
use common::sense;
#use feature qw(say);
use Mail::Box::MailDir;
use Mail::Box::Manager;
use Config::General qw(ParseConfig SaveConfig);
use Date::Manip qw(UnixDate Date_Cmp);
use Getopt::Std;
@alexfouche
alexfouche / v900_to_gpx
Last active January 4, 2020 18:58
Convert GPS data from Columbus V900 to GPX format
#/bin/sh
#
# Convert Visiontac VGPS-900 log file to GPX
#
# 2009-02-08
# mip@rootcamp.net
#
SED='/usr/local/bin/gsed' # brew install gnu-sed
GREP='/usr/bin/grep'
@alexfouche
alexfouche / gist_commit
Last active January 4, 2020 18:24
Commit and push Gist from symlink to the gist file
#!/bin/bash
# set -e
# set -x
main() {
symlink="$1"
comment="$2"
file=`readlink -e "$symlink"`
where=`dirname "$file"`
#!/usr/bin/ruby -w
=begin
/***************************************************************************
* Copyright (C) 2008, Paul Lutus *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
@alexfouche
alexfouche / photo_renomme_date
Last active January 4, 2020 17:27
Search all subfolders for photos/videos to rename from their Exif data. Also compress videos to 720height 3000kbps x264 mp4
#!/usr/bin/env bash
#set -x
# Search all subfolders for photos/videos to rename from their Exif data.
# Also compress videos to 720height 3000kbps x264 mp4 (which is roughly divide size by ten from my camera .mov files)
# https://gist.github.com/1923696
where=$1
test -z "$where" && where='.'