Skip to content

Instantly share code, notes, and snippets.


Ben Moon GuiltyDolphin

View GitHub Profile
GuiltyDolphin /
Created Jun 20, 2016
Simple script for updating Cinnamon wallpapers
#!/usr/bin/env perl
# Change Cinnamon desktop background.
# USAGE: $HOME/Pictures/Wallpapers/...
# change-wallpaper - update Cinnamon wallpapers
# Copyright (c) 2016 Ben Moon
# 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 3 of the License, or
GuiltyDolphin /
Last active Sep 6, 2016
Fix for weird (slow) DNS lookup issue
# Must be run as root
# Run dnsmasq
# Run nscd
# Add 'options single-request' to /etc/resolv.conf (see below)
echo 'options single-request' >> /etc/resolv.conf
# If *that* doesn't work, may need to add a reasonable DNS
# echo -e "nameserver \noptions single-request" > /etc/resolv.conf
GuiltyDolphin / structure.txt
Created Apr 28, 2016
Haskell typical project structure
View structure.txt
app/ -- Root-dir
src/ -- For keeping the sourcecode
Main.lhs -- The main-module
App/ -- Use hierarchical modules
Win32/ -- For system dependent stuff
cbits/ -- For C code to be linked to the haskell program
testsuite/ -- Contains the testing stuff -- Will run all tests
View unicode_re.txt
GuiltyDolphin /
Last active Jan 26, 2016
Check markdown links using awesome_bot
GuiltyDolphin /
Created Jan 21, 2016
Perl script for checking the validity of URLs referenced in Markdown.
#!/usr/bin/env perl
# Check that URLs used in Markdown files actually point somewhere.
use strict;
use warnings;
use LWP::Simple;
use List::MoreUtils qw(uniq);
use Data::Printer;
GuiltyDolphin /
Last active Jan 15, 2016
Quick script for parsing datestrings and returning the number of seconds since the Epoch they represent.
# Parse a date string (using DateTime::Format::HTTP) and return the number of seconds since epoch it represents.
date-to-epoch-perl () {
perl -MDateTime::Format::HTTP -E "say DateTime::Format::HTTP::parse_datetime('$1')->strftime('%s');";
# Better
date-to-epoch () {
date --date="$1" +%s;
GuiltyDolphin /
Created Nov 21, 2015
Move files out of sub-directory in git.
git filter-branch --index-filter \
'git ls-files -s | sed -r "s-(\t\"*)DIRNAME/(.*)-\1\2-" | \
git update-index --index-info &&
GuiltyDolphin / Basic.cabal
Last active Sep 6, 2015
Template cabal file for library+executable+tests+benchmarks
View Basic.cabal
name: basic
synopsis: Quick one-line summary of project.
license: GPL-3
license-file: LICENSE
author: Author Name
maintainer: maintainer@someplace.tld
copyright: Copyright (C) Copyright Holder
-- category:
build-type: Simple