Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jmorahan on github.
  • I am jmorahan (https://keybase.io/jmorahan) on keybase.
  • I have a public key ASBOMQn5gEffBy6pt1b1nu2ZbUdqj-osJBEXGKj8LeLJGAo

To claim this, I am signing this object:

@jmorahan
jmorahan / gist:8c709918b3c8914868065e9ec5fbb3c2
Created September 22, 2017 13:28
ctools collapsible-div
<div class="ctools-collapsible-container ctools-collapsed">
<h2 class="ctools-collapsible-handle">Click here</h2>
<div class="ctools-collapsible-content">This appears</div>
</div>
@jmorahan
jmorahan / default-params.sh
Created April 27, 2017 11:28
bash script default parameters variable
#!/bin/bash
declare -a DEFAULTS PARAMS
DEFAULTS=(foo bar "baz quux")
PARAMS=("${@:-${DEFAULTS[@]}}")
printf "%s\n" "${PARAMS[@]}"
#!/bin/bash
## Copyright (C) 2009 Przemyslaw Pawelczyk <przemoc@gmail.com>
## License: GNU General Public License v2, v3
#
# Lockable script boilerplate
### HEADER ###
LOCKFILE="/var/lock/$(basename "$0")"
@jmorahan
jmorahan / .htaccess
Last active August 4, 2018 19:47
HSTS with Apache
<IfModule mod_headers.c>
# Remove any previously set header from the 'onsuccess' table.
Header unset Strict-Transport-Security
# Set the header in the 'always' table for HTTPS requests, replacing any previous header.
Header always set Strict-Transport-Security "max-age=31536000; includeSubdomains" env=HTTPS
# For HTTP requests, the header should not be sent.
Header always unset Strict-Transport-Security env=!HTTPS
</IfModule>
@jmorahan
jmorahan / saved-stories.sh
Created February 9, 2015 18:29
NewsBlur saved stories download
#!/bin/bash
# Log in. Substitute your own username and password here.
echo "Logging in..."
curl --cookie-jar cookies -d username=somebody -d password='secret' https://www.newsblur.com/api/login >/dev/null
PAGE=0
while
# Download the next page of saved stories.
PAGE=$(($PAGE + 1))