Skip to content

Instantly share code, notes, and snippets.

View rnkn's full-sized avatar

Paul W. Rankin rnkn

View GitHub Profile
@rnkn
rnkn / nnrss-fetch-async.el
Last active August 29, 2015 14:07
Emacs function to run a dynamic asynchronous shell command to fetch RSS feeds
(defun -nnrss-fetch-async ()
"Run a dynamic asynchronous shell command to fetch RSS feeds.
Creates a dynamic shell command to fetch RSS feeds in
`nnrss-group-alist' and runs using `async-shell-command'."
(interactive)
(or nnrss-use-local
(setq nnrss-use-local t))
(let* ((rssdir (expand-file-name nnrss-directory))
list
(fetch-str
@rnkn
rnkn / paginator.html
Last active October 27, 2015 18:57
A better Jekyll paginator
{% if paginator.total_pages > 1 %}
<p>
{% if paginator.previous_page == 1 %}
<a href="{{ '/blog/' | prepend: site.baseurl }}">previous</a>
{% elsif paginator.previous_page %}
<a href="{{ paginator.previous_page_path | prepend: site.baseurl }}">previous</a>
{% else %}
previous
{% endif %}
@rnkn
rnkn / manifest.fountain
Last active August 29, 2015 14:07
Proposed Mountain syntax
INT. DR. MOROSE'S LAIR - DAY
DR. MOROSE
Welcome to my lair.
[[ reference: foo.fountain ]]
I/E. DR. MOROSE'S MOROSE MOBILE - MOVING
AGENT AGNUS
I'll get you Morose!
@rnkn
rnkn / scaffold.sh
Last active August 29, 2015 14:20
A simple Bash script for project folder structuring
#! /bin/bash
#
# Scaffold creates a project directory structure like...
# ~
# |-- Desktop
# |-- Developer
# | `-- project
# |-- Documents
# | `-- project
# |-- Downloads
@rnkn
rnkn / fizzbuzz.el
Last active September 26, 2015 03:34
Emacs fizzbuzz function
(defun fizzbuzz ()
"For numbers 1 through 100: if the number is divisible by 3 and
5 print FizzBuzz; if the number is divisible by 3 print Fizz; if
the number is divisible by 5 print Buzz; else, print the number."
(interactive)
(let ((n 1))
(while (<= n 100)
(cond ((and (= (% n 3) 0)
(= (% n 5) 0))
(insert "FizzBuzz" ?\n))
@rnkn
rnkn / addfriend.sh
Last active August 29, 2015 14:22
txtdir.net script for adding friends links
#! /bin/sh
usage="Usage: addfriend friend1 [friend2 ...]"
friendsdir=$HOME/public/friends
if [ ! -d $friendsdir ]
then
echo "Making friends directory..."
mkdir -pv $friendsdir
fi
@rnkn
rnkn / ssweeper.sh
Last active August 29, 2015 14:22
txtdir.net script for removing non-text files
#! /bin/sh
usage="Usage: ssweeper -c
\nWARNING: this will remove all files in /usr/home/* that do not match
\ntypes directory, empty or text"
if [[ $1 = "-c" ]]
then
find /usr/home/* | while read file
do
@rnkn
rnkn / ns-keys.el
Last active June 30, 2016 06:10
macOS command keys for Emacs
(when ns-window-system
(setq ns-command-modifier 'hyper)
(let ((cmd (cond ((eq ns-command-modifier 'hyper) "H-")
((eq ns-command-modifier 'super) "s-"))))
(global-set-key (kbd (concat cmd "<left>")) 'beginning-of-line)
(global-set-key (kbd (concat cmd "<right>")) 'end-of-line)
(global-set-key (kbd (concat cmd "<up>")) 'beginning-of-buffer)
(global-set-key (kbd (concat cmd "<down>")) 'end-of-buffer)
(global-set-key (kbd (concat cmd "o")) 'find-file-existing)
(global-set-key (kbd (concat cmd "n")) 'make-frame)
@rnkn
rnkn / For A Few Days More.fdx
Created July 3, 2016 14:27
Nicholl Fellowship sample script
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<FinalDraft DocumentType="Script" Template="No" Version="1">
<Content>
<Paragraph Type="Action">
<Text>FADE IN:</Text>
</Paragraph>
<Paragraph Number="" Type="Scene Heading">
<Text>INT. DRISKILL HOTEL SEMINAR ROOM - DAY</Text>
</Paragraph>
<Paragraph Type="Action">
#! /usr/bin/env bash
eval $(/usr/libexec/path_helper)
source "${HOME}/.bashrc"
red=$(tput setaf 1)
green=$(tput setaf 2)
reset="\e[0m"
DATA=$(curl --silent https://api.bitfinex.com/v1/pubticker/btcusd)
HIGH=$(echo $DATA | jq ".high" | tr -d \")