Skip to content

Instantly share code, notes, and snippets.


Alba Mendez mildsunrise

View GitHub Profile
mildsunrise /
Created May 25, 2014
Building Flash utilities from Flex Falcon under Linux

Building Flash utilities from Flex Falcon, under Linux

Falcon is the next compiler for the Flex framework. The Flash part has interesting utilities that allow for deep parsing of SWFs. We're going to (partially) build Falcon in order to get the JARs containing the utilities.
It's a tricky process, and involves a 180MB download.

We'll need Git, the JDK, Ant and JFlex, so get them:

sudo apt-get install git openjdk-7-jdk ant jflex
mildsunrise /
Last active Aug 29, 2015
Playing with notes and frequencies...
# Get the frequency, in Hertz, from an octave number.
# `0` corresponds to A0, `1` to A1, etc.
frequencyOf = (octaves) ->
27.5 * Math.pow(2, octaves)
# Parse a note string into its corresponding octave number.
# Note: this cannot parse sharp (#) notes yet.
parseNote = (string) ->
point = string.charCodeAt(0) - 65
offset = point * 2
mildsunrise /
Last active Aug 29, 2015
Fast derivative evaluator for polynomials
derivative = (coefficients, point, k) ->
return 0 if k >= coefficients.length
result = 0
factor = 1
# Initial factor (k factorial)
for i in [1..k]
factor *= i
# Calculate result
mildsunrise / searcher.c
Last active Aug 29, 2015
Simple, fast binary searcher for huge files.
View searcher.c
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#define LOOKAHEAD 8
#define START 0
mildsunrise / encode.c
Last active Aug 29, 2015
Asynchronous signal encoding
View encode.c
* Reads four bytes at `i`, and wraps them with
* start bits and stop bits as appropiate to
* produce a typical UART 8N1 signal.
* The resulting five bytes are written at `o`.
* Author: Xavier Mendez
* This code is in the public domain.
mildsunrise /
Last active Oct 2, 2015
Fast, simple, extensible Node.JS direct proxy.
http = require 'http'
util = require 'util'
url = require 'url'
server = http.createServer (req, res) ->
request = url.parse req.url
request.headers = req.headers
request.method = req.method
mildsunrise / gcd.styl
Last active Oct 11, 2015
Greatest Common Divisor comes to Stylus!
View gcd.styl
unless b
return a
gcd(b, a%b)
a*b / gcd(a,b)
mildsunrise / test.c
Last active Oct 22, 2015
VMIN=0 + select(), possible kernel bug?
View test.c
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/select.h>
int main() {
// 1. Retrieve current terminal attributes

Keybase proof

I hereby claim:

  • I am jmendeth on github.
  • I am jmendeth ( on keybase.
  • I have a public key whose fingerprint is B256 B287 DA4B 6D5D 48E5 4C75 D453 8FF0 C567 D130

To claim this, I am signing this object:

mildsunrise / gcd.groovy
Created Mar 1, 2012
Greatest Common Divisor (GCD), compressed
View gcd.groovy