Skip to content

Instantly share code, notes, and snippets.

View bachya's full-sized avatar

Aaron Bach bachya

View GitHub Profile
@bachya
bachya / Static Markdown Links from Safari.scpt
Last active August 29, 2015 14:06
For use in TextExpander or aText. Grabs the current tab in Safari and returns a Markdown link with the correct URL and a prompt to enter the link text.
@bachya
bachya / Dynamic Markdown Links from Safari.scpt
Last active August 29, 2015 14:06
For use in TextExpander or aText. Grabs the current tab in Safari and returns a Markdown link with the current title and URL.
@bachya
bachya / Static Markdown Links from Chrome.scpt
Last active August 29, 2015 14:06
For use in TextExpander or aText. Grabs the current tab in Chrome and returns a Markdown link with the correct URL and a prompt to enter the link text.
@bachya
bachya / Dynamic Markdown Links from Firefox.scpt
Last active August 29, 2015 14:06
For use in TextExpander or aText. Grabs the current tab in Firefox and returns a Markdown link with the current title and URL.
@bachya
bachya / DD-WRT DNS Router.sh
Created September 5, 2014 17:28
iptables rules to re-route specific hosts to certain DNS servers in DD-WRT
# For the Media Center, use WAN DNS (i.e., Comcast).
# #############################################################
iptables -t nat -A PREROUTING -i br0 -s media-center.phil.lan -p tcp --dport 53 -j DNAT --to $(nvram get wan_get_dns | awk -F' ' '{print $1}')
iptables -t nat -A PREROUTING -i br0 -s media-center.phil.lan -p udp --dport 53 -j DNAT --to $(nvram get wan_get_dns | awk -F' ' '{print $1}')
# For the PS3, use WAN DNS (i.e., Comcast).
# #############################################################
iptables -t nat -A PREROUTING -i br0 -s ps3.phil.lan -p tcp --dport 53 -j DNAT --to $(nvram get wan_get_dns | awk -F' ' '{print $1}')
iptables -t nat -A PREROUTING -i br0 -s ps3.phil.lan -p udp --dport 53 -j DNAT --to $(nvram get wan_get_dns | awk -F' ' '{print $1}')
@bachya
bachya / Evernote Checkboxes to Toodledo.scpt
Created September 5, 2014 17:25
Send Evernote checkboxes to Toodledo
tell application "Evernote"
set td_email to "[email protected]"
set tag_toSend to "toodledo"
set tag_complete to "toodledo-complete"
set en_notes to find notes "tag:" & tag_toSend & " todo:false"
repeat with en_note in en_notes
set the_ENML to get ENML content of en_note
@bachya
bachya / Modified Markdown to Evernote.rb
Created September 5, 2014 16:28
Modified version of Tim Lockridge's Markdown to Evernote that allows for checkboxes
#!/usr/bin/env ruby -wKU
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------------------------------------
# Markdown to Evernote (Modified)
#
# A modification of Tim Lockridge's Markdown to Evernote Textmate bundle that allows for Evernote checkboxes
# to be interpreted correctly.
#
# Markdown to Evernote copyright Tim Lockridge 2014 <http://timlockridge.com>
@bachya
bachya / Receipts in Evernote.scpt
Created September 5, 2014 06:02
A slightly modified version of https://gist.github.com/bachya/4f861098e52f95cbee22 (for receipts in Evernote)
tell application "Evernote"
activate
create note from file theFile notebook {"Personal"} tags {"receipt/statement"}
end tell
@bachya
bachya / bp.sh
Created September 5, 2014 05:43
Shell script to create a new blog post (via Geeknote and vim)
bp () {
if [ "$#" -ne 0 ] || [ "$1" = "-h" ] || [ "$1" = "–help" ]
then
echo "Usage: $0" >&2
return 1
fi
# Fill these out with values you like.
local tag_string=“draft”
local notebook=“Sentinote”
@bachya
bachya / Save nvALT Checkboxes to OmniFocus.scpt
Created September 5, 2014 05:33
Applescript to save `[ x ]` symbols in nvALT as OmniFocus tasks
on hazelProcessFile(theFile)
set p to POSIX path of theFile
set l to paragraphs of (do shell script "grep '\[ x \]' " & quoted form of p)
tell application "OmniFocus" to tell document 1
repeat with v in l
set taskName to (do shell script "n="" & v & ""; echo ${n:6}")
set taskNote to "Created from nvALT: nvalt://find/" & my encode_text(my remove_extension(my basename(p)), true, false)
make new inbox task with properties {name:taskName, note:taskNote}
end repeat