Skip to content

Instantly share code, notes, and snippets.

@heikkil
heikkil / raw_copy
Created February 4, 2016 07:17
copy raw images corresponding to jpgs in a subdir into an other subdir
#!/usr/bin/env perl
use Modern::Perl;
use File::Find;
use Getopt::Long;
use constant PROGRAMME_NAME => 'raw_copy';
use constant VERSION => '0.2';
GetOptions(
'v|version' => sub{ print PROGRAMME_NAME, ", version ", VERSION, "\n";
@heikkil
heikkil / fill-or-unfill.el
Created August 28, 2018 16:09
Version of #'endless/fill-or-unfill and key bindings that work in org-mode
(defun endless/fill-or-unfill ()
"Like `fill-paragraph', but unfill if used twice."
(interactive)
(let ((fill-column
(if (eq last-command #'endless/fill-or-unfill)
(progn (setq this-command nil)
(point-max))
fill-column)))
(if (eq major-mode 'org-mode)
(call-interactively #' org-fill-paragraph)
@heikkil
heikkil / org-clock-merge.el
Last active September 24, 2019 19:14
Merge the org CLOCK line with the next CLOCK line
(defun org-clock-merge (arg)
"Merge the org CLOCK line with the next CLOCK line.
Requires that the time ranges in two lines overlap, i.e. the
start time of the first line and the second time of the second
line are identical.
If the testing fails, move the cursor one line down.
Universal argument ARG overrides the test and merges
@heikkil
heikkil / org-duplicate-heading.el
Last active October 4, 2020 16:54
Report org headings with duplicate names in the *Messages* buffer. Reveal them and move to the last duplicate. Run after saving the buffer.
(require 'dash)
(defun org-duplicate-heading ()
"Move to duplicate heading in the current org buffer."
(interactive)
(let ((header-list '()))
(org-element-map (org-element-parse-buffer) 'headline
(lambda (x)
(let ((header (org-element-property :raw-value x))
(begin (org-element-property :begin x)))
(when (-contains? header-list header)