Skip to content

Instantly share code, notes, and snippets.

View jordanmerrick's full-sized avatar

Jordan Merrick jordanmerrick

View GitHub Profile
@jordanmerrick
jordanmerrick / dropbox-cli-notify
Last active December 14, 2015 08:29
Notification if Dropbox CLI stops running in CentOS
## Dropbox email notification if the daemon has stopped running
## Change name@address.com to the address you want to email.
./dropbox.py status | grep -q 'running' && printf "Dropbox has stopped running on $HOSTNAME.\nLast checked $(date)\n" | mail -s "Dropbox Failure Notification on $HOSTNAME" name@address.com
@jordanmerrick
jordanmerrick / dropbox-pelican-auto-update
Created April 11, 2013 10:36
Automatically update Pelican via Dropbox by using the following shell script as a cron running every minute. Just make sure your user can run "make" without needing sudo (causes a TTY error otherwise and fails).
#!/bin/bash
Respawn="/home/user/Dropbox/files/respawn"
if [ -f $Respawn ]
then
make html -C /var/www/yoursite;rm $Respawn
else
exit 0
fi
exit 0
# Add to <VirtualHost> in httpd.conf
RewriteMap lc int:tolower
# Add to .htaccess, can change the second line to anything if you don't want to limit it to just /tag/
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule ^tag/. ${lc:%{REQUEST_URI}} [R=301,L]
@jordanmerrick
jordanmerrick / Convert pelican tags to lowercase
Last active December 17, 2015 11:09
Finds any line starting with "tags:" (case insensitive) and converts any tags to lowercase
## This is destructive as it modifies the files in the directory you're currently in (only if they're .md) but always have a backup.
## I've tested this and it works ok for me, converting the tags all to lowercase. This was run in OS X 10.8.3
## Either copy/paste the entire line or create a shell script with it.
perl -pi -w -e 's/(?i)^tags:.*\n$/lc/ge' *.md
@jordanmerrick
jordanmerrick / Load an alternative CSS file depending on the time of day
Last active December 17, 2015 20:58
Load an alternative/additional CSS file depending on the visitor's current time.
<script>
var currentTime = new Date().getHours();
if (22 <= currentTime&&currentTime < 24 || 0 <= currentTime&&currentTime < 6) {
document.write("<link rel='stylesheet' href='{{ SITEURL }}/theme/css/night.css' type='text/css'>");
}
</script>
@jordanmerrick
jordanmerrick / Clear TemporaryItems
Created December 19, 2013 13:48
Microsoft Office 2011 utilises the 'TemporaryItems' folder of Mac OS X, much like any other app. If there are any permissions issues within this folder, it can cause a number of problems with Office's Autosave function or prevent the function of emailing documents from within apps, such as Excel. While the path to the folder can be almost random…
set tFolder to path to temporary items
display dialog "Clear Temporary Items?" buttons {"Yes", "No"} default button 2
if the button returned of the result is "Yes" then
tell application "Finder"
delete tFolder
end tell
else
error number -128
@jordanmerrick
jordanmerrick / statusboard_panel_gcal
Last active August 11, 2016 20:27
A custom table panel for Panic's Status Board that can tabulate a Google Calendar feed.
<!-- 5by5 Live Show Panel for Status Board -->
<!-- Written by Jordan Merrick - https://www.jordanmerrick.com -->
<!-- JS based upon Google Calendar API -->
<!-- GOOGLE HAS SINCE DEPRECATED GOOGLE CALENDAR API v1 & v2, RENDERING THIS SCRIPT UNUSABLE -->
<!-- You are welcome to adapt it but it will no longer function -->
<title>5by5 Panel</title>
<script>
// Set the date range start for Google Calendar parsing since we only want the schedule for the next 30 days
@jordanmerrick
jordanmerrick / workflow.md
Created October 18, 2016 19:42
A gist created in Workflow

This gist was created with Workflow.

@jordanmerrick
jordanmerrick / feed.json
Created May 20, 2017 17:40
JSON feed template for Jekyll.
---
layout: null
---
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ site.title | xml_escape }}",
"home_page_url": "{{ site.url }}",
"icon": "{{site.url }}/media/icons/apple-touch-icon.png",
"favicon": "{{ site.url }}/media/icons/favicon.ico",
"feed_url": "{{ site.url }}/feed.json",
@jordanmerrick
jordanmerrick / "Read Later" links for Squarespace blogs
Last active May 25, 2017 06:30
The following HTML code adds some links to easily send a Squarespace blog posts to the "Read Later" services Instapaper, Pocket and Readability. Add it to the "Post Blog Item Code Injection" and customise your CSS to suit.