Skip to content

Instantly share code, notes, and snippets.


Aleksandr Pasechnik apiarian

View GitHub Profile
#! /usr/bin/env python
# Aleksandr Pasechnik
# 2014-04-16
# Reads through the Safari Reading List for urls containing
# Presents a reverse numbered list of the item titles
# Opens the selected item in Google Chrome
# Because Safari is currently introducing stutters into all youtube videos
import os
# Aleksandr Pasechnik
# Goes through the Day One journal and moves entries that start with text which
# matches the regular expresion search string to a new journal location. It
# also moves any associated photos. Day One doesn't currently support multiple
# journals, so this is currently only useful for archiving a specific subset of
# entries.
# NOTE: base_dir may need to be adjusted to the correct Journal_dayone location
apiarian /
Last active Aug 29, 2015
python3 email robot to be run periodically
#! /usr/bin/env python3
# is an email robot
# It connects to an IMAP mail server, looks at all of the messages,
# picks out the ones that have just a U or u in the Subject: header,
# scans them for all of the image attachments, saves them to a
# web-server accessible uploads folder, and replies to the message
# through the SMTP server with the URL(s) of the uploaded photos.
# The images are renamed to a UUID. Any message that got a reply is
# then deleted from the IMAP server.
#! /usr/bin/env python2
# Goes through the Transmission resume/ directory and changes the destinations
# of the transfers from the old_location to the new_location. This assumes that
# the transfer directories have been mirrored perfectly from the old_location
# to the new_location. TransmissionBT must not be running while this script is
# executed. More information about the resume files can be found at
# . Uses the bencode library
# available on pypi.
#! /usr/bin/env python3
pi_str = '3.1415926535897932384626'\
apiarian / eta
Created Jun 13, 2011
Prints the end time of the current QuickTime Player movie.
View eta
#! /bin/sh
if [[ `ps -A | grep QuickTime | grep -v grep -c` -eq 1 ]]; then
if [[ `osascript -e 'tell app "QuickTime Player" to count documents'` -gt 0 ]]; then
t=`osascript -e 'tell app "QuickTime Player" to current time of first document as integer'`
d=`osascript -e 'tell app "QuickTime Player" to duration of first document as integer'`
cur=`date +%s`
end=`echo $cur + $d - $t | bc`
date -r $end +%H:%M:%S
package MasterableThing;
use Moose;
has 'master' => (is => 'rw');
sub do_this_thing {
my $themaster = $_[0]->master;
my $theoriginal = $_[0];
View safe_VimDebug.vim.patch
--- VimDebug.vim 2013-05-25 22:57:31.000000000 +0000
+++ ~/.vim/plugin/VimDebug.vim 2015-12-04 20:46:43.000000000 +0000
@@ -8,10 +8,15 @@
if (!has('perl') || !has('signs'))
echo "VimDebug requires +perl and +signs"
+perl eval 'use Vim::Debug'; $r=$@?0:1; VIM::DoCommand("let foundVimDebug = $r");
+if (foundVimDebug == 0)
# Aleksandr Pasechnik
# Creates an animated gif out of the photos found in a Day One journal
# based the first line of the entry ('Daily self portrai' in my case).
# Animated gifs are generated using imagemagick
import os
import plistlib
import subprocess
apiarian /
Created Jul 23, 2013
A Django based Piwik -> StatusBoard bridge
# Aleksandr Pasechnik
# A Django function which bridges Piwik and StatusBoard
# Django:
# Piwik:
# StatusBoard:
# PiwikAPI:
You can’t perform that action at this time.