Skip to content

Instantly share code, notes, and snippets.

View lsdr's full-sized avatar

Luiz Rocha lsdr

  • São Paulo, Brazil
  • 16:28 (UTC -03:00)
View GitHub Profile
@lsdr
lsdr / get_the_logs.sh
Last active October 30, 2018 00:08
Fetch RDS logs
#!/bin/sh
#
# usage:
# $ sh get_the_logs.sh [rds-instance-name]
#
function __describe_logs {
aws rds describe-db-log-files --db-instance-identifier $1
}
@lsdr
lsdr / ambulance.js
Created December 17, 2018 18:00
count IR total among NFL current injuries list
// Pro Football Reference | Current NFL Injuries
// https://www.pro-football-reference.com/players/injuries.htm
var elements = document.getElementById("div_injuries");
var injuries = elements.querySelectorAll("td[data-stat='injury_class']");
var seasonEnding = Array.prototype.slice.call(classes).filter(el => el.textContent == "I-R");
console.log(injuries.length);
console.log(seasonEnding.length);
@lsdr
lsdr / data-engineering-howto.md
Created June 14, 2019 19:27
Data Engineering Howto
@lsdr
lsdr / asciify.py
Last active July 19, 2019 14:44
Remove accentuation from a utf-8/latin-1 "string" (which should actually a byte-string) to ascii
import unicodedata
def asciify(string, encoding='latin-1'):
"""Given an string with bytes coming from a DB or other ill-developed data
extraction, cleanup and return an ASCII string free of accentuations.
>>> asciify('Ba\xc3\xba')
'Bau'
>>> asciify('Bau')
'Bau'
@lsdr
lsdr / teste.clj
Created September 4, 2019 13:45
Simplest Clojure example script
(defn square [x] (* x x))
(println (take 25 (map square (range))))
@lsdr
lsdr / passgen.rs
Created March 30, 2020 02:23
Small password gen in Rust
// Original code:
// https://github.com/rodolfoghi/learn-rust/tree/master/raspberrypi-projects/password_generator
//
use rand::Rng;
use std::io;
fn main() {
let chars = "abcdefghijklmnopqrstuvxz1234567890!@#$%&*()-+=?;:.><.\\|{}[]";
println!("Password Generator");