Skip to content

Instantly share code, notes, and snippets.

View mildsunrise's full-sized avatar
🦊
*rolls*

Alba Mendez mildsunrise

🦊
*rolls*
View GitHub Profile
@mildsunrise
mildsunrise / tour.html
Last active December 20, 2015 01:09
Simple tour
<!-- the slides -->
<div id="slides">
<div class="slide">
<!-- Content of slide #1 -->
</div>
<div class="slide">
<!-- Content of slide #2 -->
</div>
<div class="slide">
<!-- Content of slide #3 -->
@mildsunrise
mildsunrise / is-it-next-to.py
Last active December 21, 2015 10:49
Best way to check wether a square is "next to" another square.
# Returns `True` if the square at `a` is in one of the
# **eight surrounding squares** of `b`; `False` otherwise.
def nextTo(a, b):
x = a[0] - b[0]
y = a[1] - b[1]
d = x*x + y*y
return 0 < d < 3
@mildsunrise
mildsunrise / dabblet.css
Created September 18, 2013 13:11
Shadow effects
/**
Shadow effects
==============
Multiple text-shadows can be stacked to
create wonderful, realistic effects.
Oh, and CSS allows for expressiveness too.
Try zooming in and disabling some shadows!
@mildsunrise
mildsunrise / dabblet.css
Created September 29, 2013 11:54
Shadow effects
/**
Shadow effects
==============
Multiple text-shadows can be stacked to
create wonderful, realistic effects.
Oh, and CSS allows for expressiveness too.
Try zooming in and disabling some shadows!
@mildsunrise
mildsunrise / determinant.coffee
Last active December 25, 2015 17:19
Matrixes. Determinants. Coffeescript. Yeah, that's pretty much it.
determinant = (M) ->
k = M.length
return 1 unless k
# copy child matrix
N = []
for y in [1...k]
N.push M[y].slice 1
# recurse
@mildsunrise
mildsunrise / sat-align.py
Created February 15, 2016 04:49
Program that tracks Dreambox's BER or SNR and emits MIDI notes
#!/usr/bin/python
import alsaseq, alsamidi, requests, time, math
from lxml import etree
INTERVAL = 70e-3
URL = "http://root:dreamboxx@10.139.205.104/xml/streaminfo"
alsaseq.client('sat-align', 0, 1, True)
map = lambda x, s, e: s + x * (e-s)
clamp = lambda x, s, e: max(min(x, e), s)
@mildsunrise
mildsunrise / ffmpeg-barebones.c
Last active June 1, 2016 17:37
Barebones FFMPEG video processor
// Barebones program that reads a video file, extracts
// the video stream, processes it someway and then encodes
// it (alone) to another file.
#include <stdio.h>
#include <libavutil/opt.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavfilter/avfilter.h>
@mildsunrise
mildsunrise / dynamic-timelapse.c
Last active June 1, 2016 17:43
Speed up a video by a dynamic factor
/**
* Program I hacked up to produce timelapses with dynamic speedup
* factor. The `get_speed` function will be called periodically
* to decide what speedup should be applied at that point of the
* input video.
*
* This works by simply duplicating / dropping frames just as the
* `fps` filter would (zero-order hold). The program is based on
* the `transcoding.c` example, and is dirty. Make sure the input
* contains no streams other than the video stream to process.
@mildsunrise
mildsunrise / candidaturas.txt
Created June 29, 2016 11:03
Raw election results for Spain Congress (2016-06-26)
Siglas Nombre Logo
ALCD ALIANZA DE CENTRO DEMOCRÁTICO http://resultados2016.infoelecciones.es/99imgs/LOGOCO990001.gif
AND PARTIDO SOMOS ANDALUCES POR ANDALUCÍA Y LOS PUEBLOS http://resultados2016.infoelecciones.es/99imgs/LOGOCO990002.gif
BNG-NÓS BNG-NÓS CANDIDATURA GALEGA http://resultados2016.infoelecciones.es/99imgs/LOGOCO990005.gif
C's CIUDADANOS-PARTIDO DE LA CIUDADANÍA http://resultados2016.infoelecciones.es/99imgs/LOGOCO990013.gif
CCa-PNC COALICIÓN CANARIA-PARTIDO NACIONALISTA CANARIO http://resultados2016.infoelecciones.es/99imgs/LOGOCO990007.gif
CCD CIUDADANOS DE CENTRO DEMOCRÁTICO http://resultados2016.infoelecciones.es/99imgs/LOGOCO990008.gif
CCD-CI CIUDADANOS DE CENTRO DEMOCRÁTICO-CANDIDATURA INDEPENDIENTE http://resultados2016.infoelecciones.es/99imgs/LOGOCO990009.gif
CDC CONVERGÈNCIA DEMOCRÀTICA DE CATALUNYA http://resultados2016.infoelecciones.es/99imgs/LOGOCO990010.gif
CENTRO MODERADO LOS VERDES-ECOPACIFISTAS http://resultados2016.infoelecciones.es/99imgs/LOGOCO990011.gif
@mildsunrise
mildsunrise / radial_avg.py
Created September 4, 2016 15:43
"Average" a series of angles in radians
import math
# Basic "convert to binomial, then back to polar" stuff, nothing interesting
def radial_avg(angles):
dx, dy = (0, 0)
for angle in angles:
dx += math.cos(angle)
dy += math.sin(angle)
return math.atan2(dy, dx)