Skip to content

Instantly share code, notes, and snippets.

View aslakr's full-sized avatar

Aslak Raanes aslakr

View GitHub Profile
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?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">
@danyell
danyell / htc.php
Last active May 12, 2022 22:17
.htaccess compiler
<?php
/*
* .htaccess compiler
*
* Recurse through all subdirectories, scan .htaccess files, and generate
* directives suitable for inclusion in an Apache configuration file.
* This lets you consolidate all .htaccess directives in the main
* (scanned once) Apache configuration. This has considerable
* performance and security benefits.
*
#!/bin/env python
import yaml
import sys
import json
import argparse
from subprocess import Popen, PIPE
import argparse
import os
@omz
omz / ShowLastPhotoMap.py
Last active March 21, 2019 16:04
ShowLastPhotoMap
# Shows the location of the last photo in the canera roll in the Maps app.
# (thanks to @HyShai for pointing out that the latitude/longitude refs are necessary)
import photos
import webbrowser
meta = photos.get_metadata(-1)
gps = meta.get('{GPS}')
if gps:
latitude = str(gps.get('Latitude', 0.0)) + gps.get('LatitudeRef', '')
@nerdtalker
nerdtalker / EXIFmover.py
Last active April 8, 2017 14:34
EXIFmover - Moves Dropbox Camera uploaded Images into sensible directories
# Name: EXIFmover.py
# Author: Brian Klug (@nerdtalker / brian@brianklug.org)
# Purpose:
# Move Files into directory based on EXIF data make and model
# Designed to un-clusterfuck the Dropbox camera upload directory which is a mess of every
# JPEG and PNG ever if you use it like I do on a bunch of phones, and thus totally unwieldy
# and full of images sorted by date or else nothing sometimes, dropbox seems nondeterminstic
# Moves files into /[Image Make]+[Image Model]/ eg /Camera Uploads/LGE Nexus 4/
// This work is licensed under the Creative Commons Attribution 3.0 United States License. To view
// a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ or send a letter
// to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
// Copyright 2009 John Tantalo <john.tantalo@gmail.com>
(function () {
// get selection
var selection = window.getSelection ? window.getSelection() :
document.getSelection ? document.getSelection() :