Skip to content

Instantly share code, notes, and snippets.

@pdbartsch
pdbartsch / OpenRefine Nominatim Geocode
Last active January 14, 2024 12:43
open-refine geocoding using OpenStreetMap's Nominatim service. (previously called google-refine)
Step One - Starting with a single address field
Edit Column > Add Column by Fetching URLs
Nominatim has a limit of 1 geocode per second so make sure to set the throttle delay to greater than 1000 milliseconds
Fetch URL based on column (quotes needed):
"http://nominatim.openstreetmap.org/search?format=json&email=[YOUR_EMAIL_HERE].com&app=google-refine&q=' + escape(value, 'url')"
------------------------------------------------------------------------------------
Step Two - Extract lat/lon from newly created JSON blobs
@bkeepers
bkeepers / .gitconfig
Created February 19, 2013 14:12
Git aliases to make new commits that fixup or are squashed into previous commits
[alias]
fixup = !sh -c 'REV=$(git rev-parse $1) && git commit --fixup $@ && git rebase -i --autosquash $REV^' -
squash = !sh -c 'REV=$(git rev-parse $1) && git commit --squash $@ && git rebase -i --autosquash $REV^' -
@ssp
ssp / xmlpassthrough.xsl
Last active December 12, 2015 05:39
XSLT hack for Solr results to pass the content of a specific field through unchanged. Allows for structured XML content in Solr results.
<?xml version='1.0' encoding='UTF-8'?>
<!--
XSL hack for retrieving structured XML data from Solr fields without re-parsing.
It assumes that the <str> field »xml« contains valid XML, replaces the
<str> tag by an <xml> tag and includes the field content without escaping.
To use this, place the XSL in the »conf/xslt« folder
and invoke the XSLT Response writer [1] for this XSL by appending
&wt=xslt&tr=xmlpassthrough.xsl
@mbostock
mbostock / .block
Last active March 1, 2024 06:07
The Gist to Clone All Gists
license: gpl-3.0
@mikeabdullah
mikeabdullah / gist:3116322
Created July 15, 2012 11:18
Safely wrapping keychain passwords with NSString/CFString
void freeKeychainContent(void *ptr, void *info)
{
SecKeychainItemFreeContent(NULL, ptr);
}
- (NSString *)passwordFromKeychainItem:(SecKeychainItemRef)keychainItem
{
void *passwordData;
UInt32 passwordLength;
OSStatus status = SecKeychainItemCopyContent(keychainItem,
@ssp
ssp / git-extract-file.markdown
Created January 23, 2012 13:21
Extract a single file from a git repository

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch

@MetroWind
MetroWind / zalgo.py
Last active January 19, 2021 19:15
My take on a Zalgo text generator. Read from stdin. See "zalgo.py --help".
#!/usr/bin/env python3
# For Python 3
######################################################################
################### Read from stdin and Zalgo-ify ####################
############# By MetroWind <chris.corsair {AT} gmail> ################
######################################################################
import sys, os
@ssp
ssp / ExifTool commands
Created January 27, 2011 19:50
exiftool commands
# Move Description tag to Title tag
exiftool '-Description>Title' *
# Move Title tag to Headline Tag
exiftool '-Title>Headline' *
# Rename from tag, adding number if necessary for uniqueness,
# without changing file dates.
exiftool '-FileName<${description}%-c.jpeg' '-DateTimeOriginal>FileModifyDate' *
@nichtich
nichtich / pica2json.pl
Created January 17, 2011 22:49
Wandelt PICA+ (egal welche Form) nach JSON (ohne Subfield-Ordnung)
#!/usr/bin/perl
use strict;
use warnings;
=head1 NAME
pica2json - Wandelt PICA+ (egal welche Form) nach JSON (ohne Subfield-Ordnung)
=cut
@blech
blech / README.md
Last active September 24, 2015 12:18
Recreate Delicious network on Pinboard

This is a naive attempt to map Delicious users to those on Pinboard. It's probably not much use to anyone now but it did a good enough job for me, back when I wrote it.