Skip to content

Instantly share code, notes, and snippets.

View Alquimista's full-sized avatar

Roberto Gea Alquimista

  • Querétaro, Qro, México
View GitHub Profile
@Alquimista
Alquimista / interpolate.lua
Created April 19, 2011 22:30
Interpolate for NyuFX
-- Almost Ctr+C Ctrl+V of
-- https://bitbucket.org/alquimista/crayon/
-- Author: Alquimista <[email protected]>
-- Equation
-- http://codeplea.com/simple-interpolation
-- http://algorithmist.wordpress.com/
-- Add this module to the includes in NyuFX [http://youka.xobor.de/]
@Alquimista
Alquimista / notifympd
Last active September 26, 2015 15:18
mpd + notify-send
notify-send "$(mpc -f "%artist%" current)" "$(mpc -f "%album%" current)\n$(mpc -f "%title%" current)"
@Alquimista
Alquimista / bakup
Last active September 26, 2015 15:18
backup
tar cf ~/backups/`date +%Y%m%d%H%M%S`.tar ~/dir
def get_pixel_colour(i_x, i_y):
import PIL.Image # python-imaging
import PIL.ImageStat # python-imaging
import Xlib.display # python-xlib
o_x_root = Xlib.display.Display().screen().root
o_x_image = o_x_root.get_image(i_x, i_y, 1, 1, Xlib.X.ZPixmap, 0xffffffff)
o_pil_image_rgb = PIL.Image.fromstring("RGB", (1, 1), o_x_image.data, "raw", "BGRX")
lf_colour = PIL.ImageStat.Stat(o_pil_image_rgb).mean
return tuple(map(int, lf_colour))
@Alquimista
Alquimista / bezdraw.py
Created October 9, 2011 20:45 — forked from jl2/bezdraw.py
Draw Bezier curves using Python and PyQt
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import math
from PyQt4 import QtGui, QtCore
def binomial(i, n):
#http://xiix.wordpress.com/2010/06/23/calculating-opacitys-effect-on-color/
def dark (val, pct):
return int(round(val*(1.0-(pct/100.0))))
def light (val, pct):
return int(round(val+((255-val)*(pct/100.0))))
def darken (R, G, B, pct):
return (dark(R, pct), dark(G, pct), dark(B, pct))
class MyClass(object):
def __init__(self):
self._foo = "foo"
self._bar = "bar"
def foo():
doc = "property foo's doc string"
def fget(self):
return self._foo
def fset(self, value):
@Alquimista
Alquimista / nanasilentbible.py
Created April 26, 2012 04:12
NANA MIZUKI - SILENT BIBLE karaoke effect (powered by Eyecandy)
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from __future__ import division
import random
import eyecandy
from eyecandy.asstags import *
FILEINPUT = "(BD) NANA MIZUKI - SILENT BIBLE [ROMAJI1]"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
import.re
post = """---
a:1
b: 2
---
asdf"""
RE_POST = re.compile("^---(?P<meta>.*)---(?P<html>.*)$", re.DOTALL)