Skip to content

Instantly share code, notes, and snippets.

View drmad's full-sized avatar
👨‍💻
hacking

Oliver Etchebarne drmad

👨‍💻
hacking
View GitHub Profile
@drmad
drmad / sunat-tc.js
Last active January 9, 2021 05:50
Convierte la web de tipo de cambio de la SUNAT a un JSON, ahora que le han añadido recaptcha :-P
res = []
document.querySelectorAll('td.js-cal-option').forEach(e => {
buy_el = (e.querySelector('div.normal-all-day'))
sell_el = (e.querySelector('div.pap-all-day'))
if (buy_el && sell_el) {
res.push({
day: parseInt(e.querySelector('div.date').innerHTML.trim()),
buy: parseFloat(buy_el.childNodes[1].textContent.trim()),
sell: parseFloat(sell_el.childNodes[1].textContent.trim()),
@drmad
drmad / romanos.rb
Created September 25, 2013 15:30
Convertidor simple de decimal a romanos. Este chiste salió de un Ruby Coding Dojo organizado por @lshimokawa , quien me dejó picado con este algoritmo :)
# ...then the mortals started the coding: utf-8 was
# chosen, because their gods love to use diæreses
#
# Romanos, por Oliver Etchebarne -- ¡Ahora con comentarios! ¡Yay!
#
# http://drmad.org
class Romanos
def self.generar ( numero )
# Valor posicional del dígito que estamos analizando