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 / README.md
Created May 25, 2014 08:15
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
mildsunrise / notes.coffee
Last active August 29, 2015 14:04
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
mildsunrise / derivative.coffee
Last active August 29, 2015 14:08
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
mildsunrise / searcher.c
Last active August 29, 2015 14:16
Simple, fast binary searcher for huge files.
#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
mildsunrise / proxy.coffee
Last active October 2, 2015 20:08
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
mildsunrise / gcd.styl
Last active October 11, 2015 10:58
Greatest Common Divisor comes to Stylus!
gcd(a,b)
unless b
return a
gcd(b, a%b)
mcm(a,b)
a*b / gcd(a,b)
@mildsunrise
mildsunrise / test.c
Last active October 22, 2015 11:31
VMIN=0 + select(), possible kernel bug?
#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
@mildsunrise
mildsunrise / gcd.groovy
Created March 1, 2012 12:43
Greatest Common Divisor (GCD), compressed
gcd={a,b->b?gcd(b,a%b):a}
mcm={a,b->a*b/gcd(a,b)}
@mildsunrise
mildsunrise / the-macro.c
Last active December 18, 2015 11:29
You see, comparing versions is a form of art.
// My artistic composition is able to compare
// two versions in a single expression! YAY!
#define FOO_AVAILABLE(major, \
minor, \
patch) \
\
( FOO_MAJOR_VERSION >major || \
( FOO_MAJOR_VERSION==major && \
\
( FOO_MINOR_VERSION >minor || \
@mildsunrise
mildsunrise / dabblet.css
Created June 23, 2013 11:33
Inner text shadow
/* Inner text shadow */
@import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700,300italic);
h1 {
font: bold 6em 'open sans condensed';
text-align: center;
/** This is where the magic happens **/
background-color: rgba(204,129,0,.9);