Normalize unicode file names (converts UTF-8 NFD to NFC).
Required by macOS clients through AFP/NFS/SMB.
Tested on Synology DSM 6.2 with built-in Python 2.7.12.
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
require 'yaml' | |
require 'rexml/document' | |
class PlistWriter | |
PLIST_STUB_DOC = %q[ | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"></plist>] |
These two files should help you to import passwords from mac OS X keychains to 1password. | |
Assumptions: | |
1) You have some experience with scripting/are a power-user. These scripts worked for me | |
but they haven't been extensively tested and if they don't work, you're on your own! | |
Please read this whole document before starting this process. If any of it seems | |
incomprehensible/frightening/over your head please do not use these scripts. You will | |
probably do something Very Bad and I wouldn't want that. | |
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous | |
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they |
#! /usr/bin/env python | |
try: | |
import lxml.etree as ET | |
except ImportError: | |
from xml.etree import ElementTree as ET | |
from StringIO import StringIO | |
import sys | |
pub_id = "-//W3C//DTD XHTML 1.1//EN" |
#!/bin/sh | |
parse_yaml() { | |
local prefix=$2 | |
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') | |
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ | |
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | | |
awk -F$fs '{ | |
indent = length($1)/2; | |
vname[indent] = $2; | |
for (i in vname) {if (i > indent) {delete vname[i]}} |
The only requirements for popup footnotes in iBooks are: | |
* Ebook has to be an EPUB3 | |
* epub:type "noteref" and "footnote" | |
So you can link to a totally separate document, as you normally would for endnotes, | |
but include the attributes so the <a> link behaves differently in iBooks, instead triggering the popup. | |
Original reference link would look something like this (in a file called ch001.html): | |
<a epub:type="noteref" href="footnote.html#note1">1</a></div> |
var randomNumbers = [42, 12, 88, 62, 63, 56, 1, 77, 88, 97, 97, 20, 45, 91, 62, 2, 15, 31, 59, 5] | |
func partition(v: Int[], left: Int, right: Int) -> Int { | |
var i = left | |
for j in (left + 1)..(right + 1) { | |
if v[j] < v[left] { | |
i += 1 | |
(v[i], v[j]) = (v[j], v[i]) | |
} | |
} |
/** | |
* Custom Image Catalog script that runs for all subfolders in a selected folder. | |
* Lays out each folder of images in the specified number of rows and columns, 2 folders per page, shows an alert if there's more images than allowed for, | |
* labels each group with the folder name, creates paragraph styles for the captions and group headings, and saves the file. | |
* | |
* Based on the built-in Image Catalog script but modified and simplified (e.g. hard-coding the settings) for my use case. | |
* Could be modified to suit different numbers of folders per page, different image quantities etc by changing the settings at the top | |
* and making tweaks to other code as needed. | |
* | |
* Could also be extended to show one dialog for settings prior to the loop, |