Skip to content

Instantly share code, notes, and snippets.

💭
🤓

David Miller davidfmiller

💭
🤓
Block or report user

Report or block davidfmiller

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View xmlpretty.py
#!/usr/bin/python
import xml.dom.minidom
import sys
input = sys.stdin.read()
dom = xml.dom.minidom.parseString(input)
pretty_xml_as_string = dom.toprettyxml(indent=' ', newl='\n')
@davidfmiller
davidfmiller / bb-launchbar.appleScript
Last active Jan 18, 2019
Send BBEdit document to LaunchBar
View bb-launchbar.appleScript
try
set mydoc to ""
tell application "BBEdit"
set mydoc to file of (document 1 of window 1)
end tell
tell application "LaunchBar"
open mydoc
end tell
View ubuntu-bootstrap.sh
# https://www.linode.com/docs/security/use-public-key-authentication-with-ssh
# /etc/update-motd.d
mkdir -p ~/.ssh && sudo chmod -R 700 ~/.ssh/
# add node user
sudo adduser node
sudo adduser node sudo
# packages
@davidfmiller
davidfmiller / 5rings.txt
Last active Sep 27, 2018
The Five Rings
View 5rings.txt
Do not ignore the many ways in the world.
Do not seek after pleasures for yourself.
Do not rely on anything whatsoever.
Think little about yourself; think deeply about the world.
Never, in all your life, think greedy or desirous thoughts.
@davidfmiller
davidfmiller / man-markdown.css
Last active May 31, 2018
BBEdit Markdown Preview CSS
View man-markdown.css
@charset "UTF-8";
html{color:#000;background:#FFF}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal}ol,ul{list-style:none}caption,th{text-align:left}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit}input,textarea,select{*font-size:100%}legend{color:#000}#yui3-css-stamp.cssreset{display:none}
html {
background: #fff;
}
body {
background: #fff;
View bb-eslint.appleScript
(* Pipe eslint output into a BBEdit results window *)
try
tell application "BBEdit"
set mydoc to file of (document 1 of window 1)
end tell
set posixPath to POSIX path of mydoc
set cmd to "/usr/local/bin/node /usr/local/bin/eslint -c ~/.eslintrc.js -f unix " & (quoted form of POSIX path of mydoc) & " | /usr/local/bin/bbresults"
do shell script cmd
on error
@davidfmiller
davidfmiller / Copy Command to Clipboard.applescript
Last active Dec 6, 2017
Copy a UNIX command to your clipboard to return to the location of your cursor in the current file
View Copy Command to Clipboard.applescript
(*
Copy UNIX command to return to current location in active BBEdit document
*)
tell application "BBEdit"
set mydocs to every text document in window 1
if (length of mydocs is greater than 0) then
set props to get properties of selection
set mydoc to first item of mydocs
View sticky-clipboard.applescript
launch application "Stickies"
tell application "System Events" to tell process "Stickies"
click menu item "New Note" of menu "File" of menu bar 1
set frontmost to true
click menu item "Paste" of menu "Edit" of menu bar 1
end tell
@davidfmiller
davidfmiller / bbedit-documents-clipboard.applescript
Last active Nov 24, 2017
Copy text document paths in the active BBEdit window to clipboard
View bbedit-documents-clipboard.applescript
(*
Copy paths of all open text documents in the active BBEdit window to your clipboard
*)
tell application "BBEdit"
set mydocs to every text document in window 1
set urls to ""
repeat with doc in mydocs
set myurl to (URL of doc)
if (myurl is not missing value) then
You can’t perform that action at this time.