Skip to content

Instantly share code, notes, and snippets.

View danielfm's full-sized avatar
🎯
Focusing

Daniel Martins danielfm

🎯
Focusing
View GitHub Profile
@danielfm
danielfm / mandelbrot.m
Last active August 29, 2015 14:05
Parallel Mandelbrot fractal implementation in Octave.
% Returns a matrix that represents an image of the Mandelbrot with the
% given parameters. More info: http://en.wikipedia.org/wiki/Mandelbrot_set
%
% Depends on: parallel
%
% Usage:
%
% % Processes the fractal in parallel using 4 workers
% M = mandelbrot (-0.75+0.1i, 200, 512, 600, 600, 4); % Seahorse valley
%
@danielfm
danielfm / config.yml
Created May 18, 2014 00:55
Flexget config
templates:
global:
pathscrub: windows
transmission:
enabled: yes
host: localhost
port: 9091
ratio: 1
tv:
content_filter:
@danielfm
danielfm / openelec-flexget-howto.md
Last active March 6, 2020 22:49
How To Install FlexGet on OpenELEC 4.0

Instructions

The first thing to do is create a file ~/.pydistutils.cfg with the following content:

[install]
install_lib = ~/py-lib
install_scripts = ~/bin
@danielfm
danielfm / index-of.rkt
Last active August 29, 2015 14:00
Boyer-Moore-Horspool implementation for rope.plt
#lang racket
(require (planet "rope.ss" ("dyoo" "rope.plt" 3)))
;; Boyer-Moore-Horspool algorithm for rope.plt
;; http://en.wikipedia.org/wiki/Boyer-Moore-Horspool_algorithm
;; http://planet.racket-lang.org/display.ss?package=rope.plt&owner=dyoo
(define (build-skip-table subrope)
(let ([sublen (rope-length subrope)]
[bcs (make-weak-hash)]
@danielfm
danielfm / speak.py
Created May 6, 2011 14:01
Google Translate text-to-speech client
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import urllib
import urllib2
import subprocess
def speak(text, language, filename):
"""
@danielfm
danielfm / world_cup_pool.lisp
Created November 3, 2010 23:14
Little Common Lisp program that returns the winners (and each winner's earnings) of a pool. Uses shallow copies to avoid mutation.
;;; Based on this gist: http://gist.github.com/439264
(defstruct bet name amount guess rate)
(defun pool-amount (pool)
(reduce #'+ (mapcar #'bet-amount pool)))
(defun pool-rates (pool)
(let ((sum (pool-amount pool)))
(mapcar (lambda (bet)
@danielfm
danielfm / world_cup_pool.clj
Created June 15, 2010 15:35
Little Clojure program that returns the winners (and each winner's earnings) of a pool.
(defstruct bet :name :amount :guess :rate)
(defn pool-amount
"Returns the sum of all bets' amounts."
[poolseq]
(reduce + (map :amount poolseq)))
(defn pool-rates
"Returns the list of bets with their corresponding earning rates."
[poolseq]