Skip to content

Instantly share code, notes, and snippets.

@snippins
snippins / nov-grep
Last active September 9, 2020 18:33
(require 'counsel)
(defun my-nov-find-id-of-file (filename)
(interactive)
(let ((i 0)
(dontbreak t))
(while (and (< i (length nov-documents))
dontbreak)
(setq i (1+ i))
(when (string-equal filename (cdr (aref nov-documents i)))
(setq dontbreak nil)
@budparr
budparr / figure.html
Last active September 23, 2020 15:39
Hugo "figure" shortcode that works with https://github.com/aFarkas/lazysizes and uses `markdownify` for title and caption #gohugo
<!-- image -->
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }} class="lazyload" />
<noscript>
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}/>
</noscript>
{{ if .Get "link"}}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
<figcaption>{{ if isset .Params "title" }}
@ruebenramirez
ruebenramirez / setup-franz-ubuntu.sh
Created September 7, 2016 17:55
setup franz on ubuntu
#!/bin/bash
sudo rm -fr /opt/franz
sudo rm -fr /usr/share/applications/franz.desktop
# create installation dir
sudo mkdir -p /opt/franz
#install franz
@chris-jamieson
chris-jamieson / setup.md
Created April 19, 2016 15:43
Set up Franz for Ubuntu
  • Download Franz for your distribution from MeetFranz.com
  • change into the same directory as the downloaded file, then sudo tar -xf Franz-linux-x64-0.9.10.tgz -C /opt/franz
  • (optional) wget "https://cdn-images-1.medium.com/max/360/1*v86tTomtFZIdqzMNpvwIZw.png" -O franz-icon.png then sudo cp franz-icon.png /opt/franz
  • (optional) sudo touch /usr/share/applications/franz.desktop then sudo vim /usr/share/applications/franz.desktop

paste the following lines into the file, then save the file:

[Desktop Entry]
Name=Franz
Comment=
@mgussekloo
mgussekloo / gist:7eb4233d15063a8e27ad
Created November 17, 2015 08:32
Updating EXIF timestamps of photos and avi's, for use with Dropbox Carousel timeline
This should be a part of the Carousel app, but whatever. You'll need ExifTool and FFMPEG.
exiftool -all= -tagsfromfile @ -all:all -unsafe -icc_profile -overwrite_original .
exiftool -if 'not $datetimeoriginal' '-DateTimeOriginal=1980:01:01 00:00:00' -overwrite_original .
ffmpeg -i "input.avi" -metadata "ICRD=1980:01:01 00:00:00" -codec copy "output.avi"
@DanielOaks
DanielOaks / yt-playlist.py
Last active June 9, 2022 03:02
Creates an m3u playlist from files downloaded using youtube-dl
#!/usr/bin/env python3
# creates an m3u playlist sorted by upload date and then name for videos
# downloaded using youtube-dl (with the --write-info-json option)
# written in 2015 by Daniel Oaks <daniel@danieloaks.net>
# released under the CC0 Public Domain license
import os
import json
from natsort import natsorted

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

@Schnouki
Schnouki / movmd.py
Created February 25, 2013 08:20
.mov/.mp4 metadata (date/time) editor
#!/usr/bin/env python3
# -*- mode: python -*-
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it under
# the terms of the Do What The Fuck You Want To Public License, Version 2, as
# published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
# details.
# Some useful resources:
@andrewharvey
andrewharvey / inplace-mbtiles2osmand.sh
Last active January 13, 2023 16:39
In-place conversion of an mbtiles SQLite3 database into an osmand offline tiles SQLite3 database.
#!/bin/sh
# To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
# rights to this work.
# http://creativecommons.org/publicdomain/zero/1.0/
SCRIPT_DIR=`dirname $0`
if [ -e $1 ] ; then
@ttscoff
ttscoff / allpinboard.rb
Created September 24, 2012 00:09
Grab all Pinboard.in bookmarks for your account, create a bookmark file for Launchbar indexing
#!/usr/bin/ruby
=begin
This script is designed to generate a simple html file with _all_ of your Pinboard.in bookmarks
The HTML file can be added to Launchbar's index as a custom bookmark file and you can search
your entire Pinboard.in collection instantly from Launchbar (by title only). It includes
any applied tags as part of the title to aid in searching.
This does no checking for deltas, it just grabs the whole bunch and overwrites the html file
every time. Don't run it too frequently.