Skip to content

Instantly share code, notes, and snippets.

Avatar

Roberto Arista roberto-arista

View GitHub Profile
@roberto-arista
roberto-arista / 1D_3states_automata.py
Created Aug 23, 2021
One dimensional cellular automata with three states
View 1D_3states_automata.py
#!/usr/bin/env python3
"""
One dimensional cellular automata with three states
If you want to know more about CAs check "A New Kind of Science" by Stephen Wolfram
https://www.wolframscience.com/nks/
"""
### Modules
View imposeBooklet.py
#!/usr/bin/env python3
# coding: utf-8
# -------------- #
# impose booklet #
# -------------- #
### Modules
from os import mkdir
from os.path import basename, join, exists
View moduloUI.py
from vanilla import Window, RadioGroup, SquareButton
class ExampleCtrl(object):
ledsAmount = 6
index = 0
def __init__(self):
self.w = Window((150, 150), '% modulo')
self.w.someLeds = RadioGroup((20, 20, -20, -20),
[""]*self.ledsAmount,
View drawUFOGlyph.py
import fontParts.world as fp
from fontTools.pens.cocoaPen import CocoaPen
def drawGlyph(glyph):
pen = CocoaPen(glyph.getParent())
glyph.draw(pen)
path = pen.path
glyphPath = BezierPath(path=path)
drawPath(glyphPath)
@roberto-arista
roberto-arista / drawWiggle.py
Created Apr 17, 2017
Draw wiggles using Python and Drawbot
View drawWiggle.py
##############################
# Draw Wiggles using Drawbot #
##############################
"""
Script by Roberto Arista, you can find the related tutorial here: https://medium.com/@roberto_arista/how-to-draw-a-wiggle-between-two-points-with-python-and-drawbot-788006c18fb0
You can find drawbot here: http://www.drawbot.com/
Code distributed with no guarantee, use at your own risk
"""
@roberto-arista
roberto-arista / adding_smart_set.py
Created Feb 25, 2015
Adding smart sets to Robofont
View adding_smart_set.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#####################
# Adding smart sets #
#####################
### Modules
import os
from mojo.UI import SmartSet, addSmartSet
@roberto-arista
roberto-arista / colorManager.py
Created Feb 25, 2015
Vanilla color manager for Robofont font editor
View colorManager.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#################
# Color manager #
#################
### Modules
from vanilla import Window, Group, ColorWell, TextBox, HorizontalLine
from AppKit import NSColor
View zip_ufos.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#############
# Zip ufos! #
#############
### Modules
import zipfile
import os
@roberto-arista
roberto-arista / hapaxator.py
Last active Aug 29, 2015
This script is able to reorder by occurrences a txt file. It returns two different txt files, words and punctuation. It is possible to choose the direction of the ordering action: increasing or decreasing.
View hapaxator.py
# Copyright (c) 2013, Federico Antonini e Roberto Arista
# MIT License
# Hapax script
### Opening libraries
import string
import re
import sys
from operator import itemgetter
@roberto-arista
roberto-arista / gazePosition_visualization.py
Last active Aug 29, 2015
A Python/Drawbot script able to visualize gaze_position.npy by Pupil Capture eye-tracker
View gazePosition_visualization.py
################################
# Gaze positions visualization #
################################
### Modules
import numpy
import sys
from operator import itemgetter
### Functions