Skip to content

Instantly share code, notes, and snippets.

View enzyme69's full-sized avatar
🎯
Blender and AR~!

Jimmy Gunawan enzyme69

🎯
Blender and AR~!
View GitHub Profile
@samisalkosuo
samisalkosuo / maze.py
Last active November 17, 2017 03:52
Some mazes classes translated from Ruby from book: Mazes for Programmers (https://pragprog.com/book/jbmaze/mazes-for-programmers). Used in MazinGame: https://github.com/samisalkosuo/mazingame
#!/usr/bin/env python
#Some mazes classes translated from Ruby
#from book "Mazes for Programmers" by Jamis Buck.
#https://pragprog.com/book/jbmaze/mazes-for-programmers
#
#Includes modifications.
#
#Execute this and you see mazes.
@asarode
asarode / generateRandomColor.swift
Last active September 18, 2024 20:50
Generating random UIColor in Swift
func generateRandomColor() -> UIColor {
let hue : CGFloat = CGFloat(arc4random() % 256) / 256 // use 256 to get full range from 0.0 to 1.0
let saturation : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from white
let brightness : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from black
return UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: 1)
}
@ny0m
ny0m / slice.py
Created June 2, 2013 15:49
A python class to split a word into separate units, split into syllables, called morphemes. Part of a portmanteau generator I built.
class Slice(object):
def __init__(self, root, leng):
self.root = root # The original word
self.leng = leng # How many morphemes should be used as the prefix for the new portmanteau
self.morphemes = []
self.output = '' #
self.slice()
def slice(self):
import re
@revolunet
revolunet / extractGifs.py
Created March 1, 2011 09:48
extract frames from animated gif using python+PIL
import os
from PIL import Image
def extractFrames(inGif, outFolder):
frame = Image.open(inGif)
nframes = 0
while frame:
frame.save( '%s/%s-%s.gif' % (outFolder, os.path.basename(inGif), nframes ) , 'GIF')
nframes += 1