Skip to content

Instantly share code, notes, and snippets.

View jbochi's full-sized avatar

Juarez Bochi jbochi

View GitHub Profile
@willbailey
willbailey / flocking.coffee
Created September 16, 2012 16:30
flocking algorithm
###
CoffeeScript port of http://processing.org/learning/topics/flocking.html
###
window.FlockingSketch = class FlockingSketch
# setup the environment and start the draw loop
constructor: ->
@setup()
@draw()
@bwhite
bwhite / rank_metrics.py
Created September 15, 2012 03:23
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np
@andkerosine
andkerosine / raskell.rb
Created August 15, 2012 05:56
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jbochi
jbochi / gist:3264872
Created August 5, 2012 13:41
POSCOMP 2012 - Conteúdos Programáticos por Área de Conhecimento

Área de Matemática

Álgebra Linear

Sistemas de Equações Lineares: método de eliminação de Gauss para sistemas lineares. Espaços vetoriais. Subespaços. Bases.

@jhulten
jhulten / server.clj
Created May 26, 2012 06:09
clojure udp aleph example
(ns statsd-clj.server
(:use [aleph.udp]
[gloss core io]
[lamina core api])
(:require [statsd-clj.config :as config]
[statsd-clj.metrics :as metrics]
[clojure.tools.logging :as log]))
(def socket-server (agent nil))
;; jbochi's solution to Least Common Multiple
;; https://4clojure.com/problem/100
(fn [& s]
(reduce
(fn lcm [a b] (/
(* a b)
((fn gcd [a b]
(if (= b 0)
a
;; jbochi's solution to Greatest Common Divisor
;; https://4clojure.com/problem/66
(fn gcd [a, b]
(if (= b 0)
a
(gcd b (mod a b))
))
@hrldcpr
hrldcpr / tree.md
Last active January 6, 2025 22:43
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@lamnk
lamnk / pypy_symlink.sh
Created December 12, 2011 00:17
Some symlinks needed to run pypy on CentOS 5.7 x64