Skip to content

Instantly share code, notes, and snippets.

@axani
axani / iTerm2Triggers.md
Last active July 9, 2022 05:41
iTerm2 Triggers for Python

About

You can colorize Python messages in iTerm by adding triggers to your profile.

Go to

iTerm > Settings > Profiles > Triggers > Edit

Triggers

Highlight Text - Traceback calls:
Traceback([\s\S]*)

@axani
axani / Run pythonscript in current iTerm window
Created June 29, 2015 15:46
CodeKit Hook: Run Python in current iTerm window
-- CodeKit -> Hooks: Run the following "Apple Script"
tell application "iTerm"
tell the current terminal
activate current session
tell the last session
write text "python \"path to/pythonscript.py\""
end tell
end tell
end tell
@axani
axani / Python and Fonts
Last active August 29, 2015 14:17
Python and fonts: Some small exercises
## Stage 1
### Prerequisites
* RoboFont
* 2 or more opened fonts in RoboFont
### Task
* Which of the opened fonts has the most glyphs?
### Abstracted
@axani
axani / ChangeMetrics
Last active December 29, 2015 07:49
Bulk change spacing of all glyphs in RoboFont
class ChangeMetrics:
def __init__(self):
for currentGlyph in CurrentFont():
left_space = currentGlyph.leftMargin
right_space = currentGlyph.rightMargin
# Define the value by which you want to change the metrics.
change_units_by = 5
@axani
axani / checkboxWindow
Created June 12, 2013 12:29
Basic window in RoboFont with checkbox
from vanilla import *
class checkboxWindow:
def __init__(self):
self.w = Window((400,400), 'SetOrganizer')
self.w.checkBox1 = CheckBox((10, 10, -10, -10), 'Label', callback=self.checkBoxCallback, value=True)
self.w.checkBox2 = CheckBox((10, 35, -10, -10), 'Label', callback=self.checkBoxCallback, value=True)