Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View GuiltyDolphin's full-sized avatar

Ben Moon GuiltyDolphin

  • DuckDuckGo
View GitHub Profile
@GuiltyDolphin
GuiltyDolphin / Basic.cabal
Last active September 6, 2015 14:46
Template cabal file for library+executable+tests+benchmarks
name: basic
version: 0.1.0.0
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
@GuiltyDolphin
GuiltyDolphin / git-remove-subdir.sh
Created November 21, 2015 17:14
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_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD
@GuiltyDolphin
GuiltyDolphin / date-to-epoch.sh
Last active January 15, 2016 15:18
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
GuiltyDolphin / perl-ping.pl
Created January 21, 2016 19:42
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
GuiltyDolphin / check_links.sh
Last active January 26, 2016 16:16
Check markdown links using awesome_bot
((?:\N{U+D83C}\N{U+DDE8}\N{U+D83C}\N{U+DDF3}|\N{U+D83C}\N{U+DDFA}\N{U+D83C}\N{U+DDF8}|\N{U+D83C}\N{U+DDF7}\N{U+D83C}\N{U+DDFA}|\N{U+D83C}\N{U+DDF0}\N{U+D83C}\N{U+DDF7}|\N{U+D83C}\N{U+DDEF}\N{U+D83C}\N{U+DDF5}|\N{U+D83C}\N{U+DDEE}\N{U+D83C}\N{U+DDF9}|\N{U+D83C}\N{U+DDEC}\N{U+D83C}\N{U+DDE7}|\N{U+D83C}\N{U+DDEB}\N{U+D83C}\N{U+DDF7}|\N{U+D83C}\N{U+DDEA}\N{U+D83C}\N{U+DDF8}|\N{U+D83C}\N{U+DDE9}\N{U+D83C}\N{U+DDEA}|\N{U+0039}\N{U+FE0F}?\N{U+20E3}|\N{U+0038}\N{U+FE0F}?\N{U+20E3}|\N{U+0037}\N{U+FE0F}?\N{U+20E3}|\N{U+0036}\N{U+FE0F}?\N{U+20E3}|\N{U+0035}\N{U+FE0F}?\N{U+20E3}|\N{U+0034}\N{U+FE0F}?\N{U+20E3}|\N{U+0033}\N{U+FE0F}?\N{U+20E3}|\N{U+0032}\N{U+FE0F}?\N{U+20E3}|\N{U+0031}\N{U+FE0F}?\N{U+20E3}|\N{U+0030}\N{U+FE0F}?\N{U+20E3}|\N{U+0023}\N{U+FE0F}?\N{U+20E3}|\N{U+D83D}\N{U+DEB3}|\N{U+D83D}\N{U+DEB1}|\N{U+D83D}\N{U+DEB0}|\N{U+D83D}\N{U+DEAF}|\N{U+D83D}\N{U+DEAE}|\N{U+D83D}\N{U+DEA6}|\N{U+D83D}\N{U+DEA3}|\N{U+D83D}\N{U+DEA1}|\N{U+D83D}\N{U+DEA0}|\N{U+D83D}\N{U+DE9F}|\N{U+D83D}\N{U+DE9E}|\N{U+D83D}\N{U+DE9D}|\N{U+D
@GuiltyDolphin
GuiltyDolphin / structure.txt
Created April 28, 2016 15:35
Haskell typical project structure
app/ -- Root-dir
src/ -- For keeping the sourcecode
Main.lhs -- The main-module
App/ -- Use hierarchical modules
...
Win32/ -- For system dependent stuff
Unix/
cbits/ -- For C code to be linked to the haskell program
testsuite/ -- Contains the testing stuff
runtests.sh -- Will run all tests
@GuiltyDolphin
GuiltyDolphin / fix-slow-dns-lookup.sh
Last active September 6, 2016 17:39
Fix for weird (slow) DNS lookup issue
# Must be run as root
# Run dnsmasq
dnsmasq
# Run nscd
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 8.8.8.8 \noptions single-request" > /etc/resolv.conf
@GuiltyDolphin
GuiltyDolphin / change-wallpaper.pl
Created June 20, 2016 14:25
Simple script for updating Cinnamon wallpapers
#!/usr/bin/env perl
# Change Cinnamon desktop background.
# USAGE: change-wallpaper.pl $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