Skip to content

Instantly share code, notes, and snippets.

View JenniferMack's full-sized avatar

Jennifer JenniferMack

View GitHub Profile
@JenniferMack
JenniferMack / link-template
Last active August 29, 2015 14:13
WP link post template
@JenniferMack
JenniferMack / fix-epub.rb
Last active August 29, 2015 14:16
ePub playOrder fix for Ulysses export
#!/usr/bin/env ruby
cnt = 1
cmd = ARGV[0]
file = ARGV[1]
begin
if cmd == "unzip"
system "unzip", "-q", file
ARGV.replace ["OPS/toc.ncx"]
elsif cmd == "zip"
@JenniferMack
JenniferMack / md-toc.rb
Last active April 11, 2024 18:22
Create a table of contents for Ulysses markdown
#!/usr/bin/env ruby
toc = "# Table of Contents\n"
newmd = ""
ARGF.each_line do |line|
newmd << line
next if !line.start_with?("#")
heading = line.gsub("#", "").strip
@JenniferMack
JenniferMack / md-tables.rb
Created April 2, 2015 05:11
A simple table maker that outputs MarkdownXL for Ulysses.
#! /usr/bin/env ruby
table = "~~\n~~ <table>\n"
ARGF.each_line do |line|
table << "~~ <tr>\n"
row = table =~ /th/ ? "td" : "th"
line.chomp.split('|').each {|cell| table << "~~ <#{row}>#{cell}</#{row}>\n" }
table << "~~ </tr>\n"
end
@JenniferMack
JenniferMack / wp-post.rb
Last active August 29, 2015 14:18
Post to WordPress from Ulysses using the xmlrpc interface.
#!/usr/bin/env ruby
require 'xmlrpc/client'
wordpress = XMLRPC::Client.new_from_hash(
{ "host" => "yourblogname",
"user" => "yourWPusername",
"password" => "yourWPpassword",
"use_ssl" => nil, #change to true if hosted on SSL
#-------------------------------------------------------#
@JenniferMack
JenniferMack / wp-automator.rb
Last active August 29, 2015 14:18
Apple Automator script to post to WordPress from Ulysses
require 'xmlrpc/client'
wordpress = XMLRPC::Client.new_from_hash(
{ "host" => "yourblogurl",
"user" => "yourWPusername",
"password" => "yourWPpassword",
"use_ssl" => nil, #change to true if hosted on SSL
#-------------------------------------------------------#
"path" => "/xmlrpc.php"
})
@JenniferMack
JenniferMack / local.EDIT-FIRST.ulysses-backup.plist
Last active August 29, 2015 14:21
Launchd scheduling plist for backing up Ulysses for Mac files.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.ulysses-backup</string>
<key>ProcessType</key>
<string>Adaptive</string>
<key>ProgramArguments</key>
<array>
[
{
"name": "Minnow-KB",
"author": "Jennifer Mack",
"background": {
"name": "Bamboo",
"style": "background-image: url('/bg/wood/bamboo.jpg');"
},
"radii": "5px",
"switchMount": "cherry",
@JenniferMack
JenniferMack / https.go
Last active July 4, 2019 22:42
Sample TLS server in #go
// Redirecting (http => https) server, will finish request before shutting down.
// All-in-one file for example purposes
// Everything below main would normally go into a `server.go` file to reduce clutter.
// Redirection is normally on, and can be disabled with `-redir=false` on the command line.
// Use with dummy certs for testing.
package main
import (
"context"
@JenniferMack
JenniferMack / tz-diff.go
Created July 6, 2019 22:47
An easy way to print out two timezones side by side.
package main
import (
"bytes"
"flag"
"fmt"
"text/tabwriter"
"time"
)