Skip to content

Instantly share code, notes, and snippets.

@MBurvill
MBurvill / hexToRGB.py
Created August 13, 2018 19:13
hex to RGB
'''
hex to rgb - matt burvill
basic premise:
-hex colour code is a string of always 6 characters
-red component is first 2 chars
-green is next 2
-blue is final 2
-int can convert hex string to interger, we can do this to each r/g/b component
-we divide it each component by 255 to get the decimal suitable for drawbot
-we pass the rgb tuple using *args
def adder(x,y,z):
print("sum:",x+y+z)
nums = (5,10,15)
adder(*nums)
#better than
adder(nums[0],nums[1],nums[2])
@MBurvill
MBurvill / isCompatibleObserverBugTest.py
Created December 17, 2017 22:58
isCompatibleObserverBugTest for RF forum
# IS COMPATIBLE BUG TEST WITH OBSERVING GLYPH CHANGES
from AppKit import *
import vanilla
from defconAppKit.windows.baseWindow import BaseWindowController
from mojo.events import addObserver, removeObserver
from mojo.roboFont import CurrentGlyph, RGlyph
class currentGlyphObserverExample(BaseWindowController):
@MBurvill
MBurvill / FrederiksExample.py
Last active November 26, 2017 21:25
glyph navigator test 1 for RF Forum
from mojo.canvas import Canvas
from mojo.drawingTools import *
import mojo.drawingTools as mojoDrawingTools
from vanilla import *
from mojo.events import addObserver,removeObserver
from defconAppKit.windows.baseWindow import BaseWindowController
import AppKit
class ExampleWindow(BaseWindowController):
@MBurvill
MBurvill / python_resources.md
Last active August 29, 2015 14:21 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides