Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

On the OS X bash command line

brew install multimarkdown
brew install fswatch

echo '#!/bin/bash
multimarkdown --full "file.md" > /tmp/file.html && open -g /tmp/file.html' > /tmp/rebuild.sh && chmod +x /tmp/rebuild.sh; fswatch -o "file.md" | xargs -n1 /tmp/rebuild.sh
#!/usr/bin/env python3
# licence: ¯\_(ツ)_/¯
import requests
s = requests.Session()
d = {
'client_id': 'client_id',
'client_secret': 'client_secret',
# export_dayone_entries.py
# Aleksandr Pasechnik
#
# This script goes through the Day One journal and exports each of the entries
# to a new markdown file in the `exportdir` directory. The `exportdir`
# directory is deleted and recreated each time the script is run, so best set
# it to something temporary (a subdirectory on the Desktop, for example).
# Photos are copied into the export directory too, with the same basename as
# the exported entries. The timestamp, location, weather, and tags are appended
# to the end of the file, if they are available. The script also sticks a '#'
--- 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"
finish
endif
+perl eval 'use Vim::Debug'; $r=$@?0:1; VIM::DoCommand("let foundVimDebug = $r");
+if (foundVimDebug == 0)
package MasterableThing;
use Moose;
has 'something' => (is => 'rw', isa => 'Str');
has 'master' => (is => 'rw');
sub do_this_thing {
my $themaster = $_[0]->master;
my $theoriginal = $_[0];
#! /usr/bin/env python3
# http://www.wolframalpha.com/input/?i=1000+digits+of+pi
pi_str = '3.1415926535897932384626'\
'433832795028841971693993751058209'\
'749445923078164062862089986280348'\
'253421170679821480865132823066470'\
'938446095505822317253594081284811'\
'174502841027019385211055596446229'\
'489549303819644288109756659334461'\
#! /usr/bin/env python2
# update_TransmissionBT_resumes.py
#
# 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
# https://trac.transmissionbt.com/wiki/ResumeFile . Uses the bencode library
# available on pypi.
@apiarian
apiarian / mailbot.py
Last active August 29, 2015 14:11
python3 email robot to be run periodically
#! /usr/bin/env python3
# mailbot.py 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.
# move_entries.py
# 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