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" |
MIT License | |
Copyright (c) 2014 Piotr Kuczynski | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWAR |
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]) | |
} | |
} |
Default umaks on macOS is 0077
, which is different with most Linux distributions.
There're pros and cons about this very decision made by Apple. For the good
part, temporary files generate under /tmp
, $TMPDIR
are accessible
by the user himself only. These locations could be alternatives to $XDG_RUNTIME_DIR
.
While, the problem is that since the new files are accessible by yourself only, it's inconvenient to share files with other users.
It's easy to change umask globally with a LauchAgent, or change it for shells
/** | |
* 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, |