Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Moon GuiltyDolphin

View GitHub Profile
@GuiltyDolphin
GuiltyDolphin / change-wallpaper.pl
Created Jun 20, 2016
Simple script for updating Cinnamon wallpapers
View change-wallpaper.pl
#!/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
@GuiltyDolphin
GuiltyDolphin / fix-slow-dns-lookup.sh
Last active Sep 6, 2016
Fix for weird (slow) DNS lookup issue
View fix-slow-dns-lookup.sh
# 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 / 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
Unix/
cbits/ -- For C code to be linked to the haskell program
testsuite/ -- Contains the testing stuff
runtests.sh -- Will run all tests
View unicode_re.txt
((?:\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 / check_links.sh
Last active Jan 26, 2016
Check markdown links using awesome_bot
View check_links.sh
@GuiltyDolphin
GuiltyDolphin / perl-ping.pl
Created Jan 21, 2016
Perl script for checking the validity of URLs referenced in Markdown.
View perl-ping.pl
#!/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 / date-to-epoch.sh
Last active Jan 15, 2016
Quick script for parsing datestrings and returning the number of seconds since the Epoch they represent.
View date-to-epoch.sh
# 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 / git-remove-subdir.sh
Created Nov 21, 2015
Move files out of sub-directory in git.
View git-remove-subdir.sh
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 / Basic.cabal
Last active Sep 6, 2015
Template cabal file for library+executable+tests+benchmarks
View Basic.cabal
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
You can’t perform that action at this time.