Skip to content

Instantly share code, notes, and snippets.

View 2shortplanks's full-sized avatar

Mark Fowler 2shortplanks

View GitHub Profile
@2shortplanks
2shortplanks / Evernote and OmniFocus integration
Created February 7, 2011 10:32
Evernote and OmniFocus integration
-- Find the note in omnifocus for the current project / folder
-- (or create a new one) and display it.
-- Created by Mark Fowler ([email protected])
-- Help from http://veritrope.com/code/search-evernote-for-notes-containing-link-to-selected-omnifocus-item/
-- on getting the name / url for the current omnifocus item
tell front window of application "OmniFocus"
try
perl -ne 'print if $a-- || ($a=/somefunc\(\)/*2)'
@2shortplanks
2shortplanks / gist:1617975
Created January 15, 2012 23:32
Sherlock: the fall

Look people it's really not that hard, is it?

Holmes, after he jad been summoned to the roof the first time, while watson sleeps, arranges someone to call to distract Watson by sending him off on a fake errand. After all, he knows he is safer on his own and he is going to have to die. He'll need him back later as a fake witness.

Holmes verbally battles mortiarty on the roof till he realises he has no choice but to fake his death. He positions watson very carefully (note he tells him exactly where to walk and tells him where to look) so that when he jumps his eyeline will be obscured by the truck at the point of 'impact' - when he lands safely on some sort of cushion.

The people at ground level are in on the trick (Mortiaty even notes that Holmes now has an audience.) They're the ones there to set up and clear away the cushion and get Holmes prepped for Watson. They're probably friends of Molly, doctors or medical staff who getting blood for his hair and drugs to surpress a heartbeat incase Watson took Hol

diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 3482f36..76f8497 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -742,9 +742,9 @@ otherwise. In list context, returns
($package, $filename, $line) = caller;
With EXPR, it returns some extra information that the debugger uses to
-print a stack trace. The value of EXPR indicates how many call frames
+print a stack trace if the stack frame exists (and the empty list if it
#!/usr/bin/env perl
use 5.016;
use warnings;
use Try::Tiny;
try {
die "Boom Boom";
} catch {
@2shortplanks
2shortplanks / gist:3407819
Created August 20, 2012 20:54
Last command run in current terminal, applescript in Perl
use Mac::AppleScript qw(RunAppleScript);
########################################################################
# work out the line on the command line
########################################################################
my $text = RunAppleScript(<<'END');
tell application "Terminal"
tell front window
history of selected tab as text
@2shortplanks
2shortplanks / gist:4048317
Created November 9, 2012 21:16
Backup twitter every hour
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.pimpyourmacwithperl.scripts.twitter</string>
<key>StartInterval</key>
<integer>3600</integer>
<key>ProgramArguments</key>
<array>
@2shortplanks
2shortplanks / NoPrintFromTerminal.kmmacros
Last active July 13, 2019 06:03
ProTip for Sublime Text mac users: Remap ⌘P <return> in Terminal with Keyboard Maestro to stop accidentally printing stuff
<?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">
<!--
Sublime Text uses the Cmd-P keboard shortcut to show a menu of recent
buffers. Hitting return selects the next buffer.
This means Cmd-P <return> is a quick way to switch between two buffers
in Sublime Text.
travis-5:a mark$ fatpack trace --to=/tmp/trace alfred_test.pl
alfred_test.pl syntax OK
travis-5:a mark$ cat /tmp
tmp@ tmpIU_JE_Downloads/
travis-5:a mark$ cat /tmp/trace
re.pm
warnings/register.pm
parent.pm
XML/Easy/NodeBasics.pm
XML/Easy/Content.pm
@2shortplanks
2shortplanks / gist:5467215
Last active December 16, 2015 16:59
modulename to distribtion name with MetaCPAN (using Elastic Search)
#!/usr/bin/env perl
use 5.016;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON::PP qw(encode_json decode_json);
sub mod2dist {