Skip to content

Instantly share code, notes, and snippets.

@elmimmo
elmimmo / mmdp.sh
Created September 22, 2011 10:43
Preview (multi)markdown in preferred browser
# Preview (multi)markdown documents in the preferred browser.
function mmdp() {
if [ -z "$1" ]; then
echo "Usage: mmdp FILE"
return 1
fi
# Determine how to open a file based on OS, and what MMD binary to use:
local OS=$(uname -s)
@elmimmo
elmimmo / xml2json.xslt
Created June 1, 2012 11:49
XSLT: from intermediate XML format to JSON
<?xml version="1.0" encoding="utf-8"?>
<!-- Stylesheet for converting between an intermediate format and JSON -->
<!-- Copyright 2006 Theo Hultberg, all rights reserved -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"
encoding="UTF-8"
@elmimmo
elmimmo / SmartyPants Readme.txt
Created July 9, 2012 15:07
Unicode SmartyPants (unofficial)
SmartyPants
===========
by John Gruber
http://daringfireball.net/
Version 1.5.1 - Fri 12 Mar 2004
SmartyPants is a free web publishing plug-in for Movable Type, Blosxom,
@elmimmo
elmimmo / cover.xhtml
Last active December 14, 2015 19:49
Display an image full-screen, proportionally, in HTML using SVG
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<title> </title>
<style type="text/css">
html, body {
height: 100%;
width: 100%;
@elmimmo
elmimmo / palette.sh
Last active December 18, 2015 16:49
Creates an image with a palete of swatches of the most common colors in an image, and their hexadecimal code, ordered by higher frequency from left to right.
#!/bin/bash
# Creates an image with a palete of swatches of the most common colors in an
# image, and their hexadecimal code, ordered by higher frequency from left to
# right.
#
# Requires Imagemagick.
#
# Author: Jorge Hernández Valiñani
@elmimmo
elmimmo / drae22.js
Created October 23, 2013 14:54
Bookmarklet para buscar una palabra (la seleccionada, si hay alguna) en el Diccionario de la Real Academia de la Lengua Española (RAE)
javascript:void(q=window.getSelection?window.getSelection():(document.getSelection?document.getSelection():(document.selection?document.selection.createRange().text:'')));if(q=='')void(q=prompt('Introduce%20una%20palabra%20para%20buscarla%20en%20el%20DRAE:',''));if(q)%7Bvoid(window.open('http://drae22.rae.es/'+encodeURIComponent(q)));%7D;
@elmimmo
elmimmo / after-toc.ncx
Last active March 8, 2016 18:09
The NCX DOCTYPE is not required in EPUB 2, and you are actually better off without it. See why.
<?xml version="1.0" encoding="UTF-8"?>
<ncx version="2005-1" xmlns="http://www.daisy.org/z3986/2005/ncx/">
<head>
<meta name="dtb:uid" content="urn:uuid:e04c4d19-57af-4495-a8c8-882695b7c8dc" />
</head>
<docTitle>
<text/>
</docTitle>
<navMap>
<navPoint id="title_page">
@elmimmo
elmimmo / local.shared.savethemblobs.plist
Last active January 23, 2018 18:43
Script to schedule automated batch-downloading of all SHSH blobs from Apple that it's currently signing for all iOS devices you own. You are expected to have ran TinyUmbrella at east once. Requires https://github.com/Neal/savethemblobs.
<?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.shared.savethemblobs</string>
<key>LowPriorityIO</key>
<true/>
<key>Nice</key>
<integer>19</integer>
@elmimmo
elmimmo / Reindex.tool
Last active November 29, 2019 12:27
Batch-add an empty file and Finder comment to a list of directories as a way of matching them to a catalog id
#!/bin/bash
# Batch-add an empty file and Finder comment to a list of directories
# as a way of matching them to a catalog id.
#
# Takes a 2-column semicolon-separated CSV file. First column is a
# directory; second column is a catalog index or id. Creates an empty
# txt file whose filename is the catalog index in the 2nd column inside
# the directory in the 1st column. Also writes the catalog index in the
# 2nd column as a Finder comment (overwriting any existing one) of the
@elmimmo
elmimmo / selectAllTumblrPosts.js
Last active January 2, 2020 14:10
Select all posts in Tumblr Mass Post Editor
var my_array = document.querySelectorAll('[id^=post_]');
var i;
for (i = 0; i < Math.min(my_array.length, 100); i += 1) {
my_array[i].click();
}