Skip to content

Instantly share code, notes, and snippets.

View jshell's full-sized avatar

Jeff Shell jshell

  • Bottlerocket Mfg
View GitHub Profile
@jshell
jshell / findbom.py
Created April 12, 2012 20:59
Quick "UTF8 With BOM" file finder in Python
"""
A quick utility script I threw together to find some files that had been
committed as `UTF-8 With BOM`. I also had the script open the files in BBEdit
so I could quickly change the files to plain UTF-8 (no byte-order mark).
There may be a way to do this safely within Python, but... meh.
"""
from __future__ import print_function
import codecs
import os
@jshell
jshell / gist:2047480
Created March 15, 2012 22:54
Underline Titles (Markdown, reStructuredText) in BBEdit
tell application "BBEdit"
set x to startLine of selection
tell text 1 of window 1
if x = 1 then return
set myline to line x
set title_line to line (x - 1)
set underline_char to contents of first character of myline
set underline_str to ""
repeat (length of title_line) times
set underline_str to underline_str & underline_char
@jshell
jshell / BBFlakes.py
Created August 19, 2011 19:20
PyFlakes Script for BBEdit 10
#!/usr/bin/env python2.6
"""
A quick script to install into your `Application Support/BBEdit/Scripts` folder.
This runs PyFlakes (requires PyFlakes to be installed at `/usr/local/bin` -
try ``/usr/bin/easy_install-2.6 pyflakes==0.4.0``) and reformats the results
so that they show up in BBEdit's search results / error / warnings window. Then
the errors can be stepped through one at a time.
I've bound this to control-shift-V. You must save your Python file first before
running the check.