Skip to content

Instantly share code, notes, and snippets.

View ruliana's full-sized avatar

Ronie Uliana ruliana

View GitHub Profile
@ruliana
ruliana / .block
Created May 14, 2016 00:11
Brazilian States Topojson (Estados do Brasil)
license: mit
height: 600
@ruliana
ruliana / FIN-item-flow-measurement.lua
Last active August 17, 2023 01:16
Lua script for print in a screen the belt throughput in FICSIT Network
---------------------
----- UTILITIES -----
---------------------
-- Utilities to get components from the network
function getComponents(className)
local compos = component.proxy(component.findComponent(findClass(className)))
if #compos == 0 then
error(string.format("No component of class \"%s\" found", className))
end
@ruliana
ruliana / FIN-load-from-url.lua
Last active August 13, 2023 03:55
Lua script for loading and executing files from URLs in FICSIT Network
-- All the scripts that should be loaded.
-- Put then in load order
local URLs = {
"https://gist.githubusercontent.com/ruliana/b48dcbaa1ddd92882e9a3cca36d6777f/raw/819bb7ebbd530a1d94601549fd6ae819ecea1cf4/FIN-item-flow-measurement.lua"
}
local card = computer.getPCIDevices(findClass("FINInternetCard"))[1]
if not card then
error("Internet card not found")
end
@ruliana
ruliana / xslt-pseudo.el
Created June 18, 2023 09:04
XSLT Pseudo Implementation in Elisp
(defun apply-templates (node templates)
(let (output)
;; loop through each template
(dolist (template templates output)
;; if the current node matches the template
(when (matches node (car template))
;; apply the template and stop processing further templates
(setq output (apply-template node template))
(return output)))
;; if no template matched, process the node's children
@ruliana
ruliana / sane-extensions.scm
Last active June 14, 2023 07:42
Sprinkling some syntax sugar on Guile Scheme to make it more pratical. Let's say "better defaults" for my personal taste :)
(use-modules (srfi srfi-1) ;; list operations
(srfi srfi-11) ;; let-values
(srfi srfi-41) ;; streams
(srfi srfi-42) ;; list comprehension
(srfi srfi-88) ;; keyword as "this:", not only "#:this"
(oop goops) ;; function overloading ("OOP" is _not_ the main point)
((ice-9 format) #:prefix fmt.))
(define-syntax def (identifier-syntax define-method))
@ruliana
ruliana / html-parsing-example.rkt
Created September 26, 2016 14:17
HTML Parsing in Racket (easy!)
#lang racket
(require net/url
html-parsing)
(define rubyconf-url "http://www.rubyconf.com.br/pt-BR/schedule#")
(define (page-get url)
(call/input-url (string->url url)
get-pure-port
html->xexp))
@ruliana
ruliana / igraph-degree-distribution.R
Last active July 7, 2022 15:32
Plotting degree distribution with igraph and ggplot2
library("igraph")
library("poweRlaw")
library("ggplot2")
# Just loading my data
edge_list <- read.csv("edge-list-ocupacoes.csv")
G <- graph.data.frame(edge_list)
# List of degrees
G.degrees <- degree(G)
@ruliana
ruliana / bimax.jl
Last active March 14, 2022 09:08
BIMAX in Julia (Biclustering Algorithm)
# References:
# Original Paper: http://ocw.metu.edu.tr/file.php/40/Schedule/reading8.pdf
# Original Algorithm: http://www.tik.ee.ethz.ch/sop/bimax/SupplementaryMaterial/supplement.pdf
# Explained for Humans: http://www.kemaleren.com/the-bimax-algorithm.html
typealias VVector{T} Vector{Vector{T}}
function bimax(m::Matrix{Int})
z = Vector{Int}[]
rows = 1:size(m, 1)
@ruliana
ruliana / builder_function.py
Last active October 11, 2021 09:05
Functional design patterns - builder function (Python)
def builder(builder_param, other_builder_param):
# ... optionally some initialization code
def the_actual_function(trivial_param):
# ... do stuff
return something
return the_actual_function
# Then later...
my_func = builder(x, y)
@ruliana
ruliana / builder-function.rkt
Last active October 11, 2021 09:03
Functional design patterns - builder function (Racket)
(define (builder builder-param other-builder-param)
; ... optionally some initialization code
(λ (trivial-param)
; ... do stuff
something))