Skip to content

Instantly share code, notes, and snippets.

View hampusn's full-sized avatar

Hampus Nordin hampusn

View GitHub Profile
@hampusn
hampusn / cleanup-transmission-list.sh
Last active June 12, 2024 05:39
A script which removes torrents from transmission when they are completed and stopped. Developed for Synology DiskStation as a cron job.
#!/bin/sh
# Called with the credentials for the rpc-username and rpc-password:
# ./cleanup-transmission-list.sh username password
# Exit early if user and pass is not passed as arguments
if [ "$1" == "" ] || [ "$2" == "" ]; then
exit 0;
fi
@hampusn
hampusn / functions.php
Last active August 29, 2015 14:16
Fix for ACF + WP Media Folder (ACF admin stops working due to javascript error in WP Media Folder)
<?php
/**
* Fixes issue where JS is halted on ACF admin pages when WP Media Folder is activated.
*
* These are the versions of the plugins I had when I tried
* - WP Media Folder - 1.0.4
* - Advanced Custom Fields Pro - (5.1.8, 5.2.1)
*
*
# Google Analytics & Campaign Monitor
# Removes all query params where the key begins with "utm_"
# Skip the rewrites if no "utm_*" key exist.
RewriteCond %{QUERY_STRING} !(^|&)utm_ [NC]
RewriteRule .* - [S=3]
# Check and handle first query param.
RewriteCond %{QUERY_STRING} ^utm_[A-Za-z0-9]+=[^&]+(.*) [NC]
RewriteRule (.*) /$1?%1 [R=301,L]

Keybase proof

I hereby claim:

  • I am hampusn on github.
  • I am hampus (https://keybase.io/hampus) on keybase.
  • I have a public key whose fingerprint is 1D87 8F65 6203 5921 3AA3 B9EA 4845 51B3 D2AB DF4A

To claim this, I am signing this object:

@hampusn
hampusn / hampusn_money_filter.rb
Created July 3, 2014 09:13
Liquid filter which formats a float with two decimals. Example usage: <p>Price: {{ 95.5 | hampusn_money }}</p>
module Jekyll
module HampusnMoneyFilter
def hampusn_money(money)
return '' if money.nil?
sprintf("%0.02f", money)
end
end
end
Liquid::Template.register_filter(Jekyll::HampusnMoneyFilter)
@hampusn
hampusn / jira-filters.md
Last active December 16, 2015 10:19
Various issue filters for JIRA.