Skip to content

Instantly share code, notes, and snippets.

@ledalert
ledalert / fifo.py
Last active August 29, 2015 14:05
FIFO for Python generators
#This fifo can be used if you have a generator that may modify objects already yielded
def fifo(generator, size):
buf=[]
for item in generator:
if len(buf) == size:
yield buf.pop(0)
buf.append(item)
for item in buf:
@ledalert
ledalert / pinoutgen.py
Created August 4, 2014 23:53
Small script to create CSS gradients for cables with 3D effect
#!/usr/bin/python3
#encoding=utf-8
# Copyright (c) 2014, Mikael Lövqvist
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.