Skip to content

Instantly share code, notes, and snippets.

View DNA's full-sized avatar

Leonardo Prado DNA

View GitHub Profile
@DNA
DNA / anotacoes_curso.md
Created March 23, 2013 21:03
Anotações do Curso de produção e edição de podcasts

Palestra Radiofobia

Primeira nota importante: Nunca confiar em adaptadores VGA-HDMI

Do rádio ao postcast

Número de anos para a mídia atingir 50 milhões de usuários

  • Rádio: 38 anos
  • Internet: 4 anos
  • iPod: 3 anos
@DNA
DNA / bgp-table-process.php
Last active December 20, 2015 12:08
Process a BGP table, returning the tabulated data into an array
<?php
/**
* Código feito em PHP, Haters Gonna Hate! :P
*
* Brincadeiras a parte, foi a forma mais eficiente de resolver o
* problema, tenho certeza que passar a lógica pra Python pra vc vai
* ser fichinha! :P
*/
<?php
class myStdClass {
public function __call($method, $args) {
if (isset($this->$method)) {
return call_user_func_array($this->$method, $args);
}
}
}
@DNA
DNA / keybase.md
Last active August 29, 2015 14:00
keybase.md

Keybase proof

I hereby claim:

  • I am DNA on github.
  • I am leonardodna (https://keybase.io/leonardodna) on keybase.
  • I have a public key whose fingerprint is 246A 18FC 2802 CE92 1BA6 9656 5242 8DE1 A4E9 0A33

To claim this, I am signing this object:

@DNA
DNA / autophoto.sh
Created August 26, 2015 17:24
take photo and screenshot every 5 minutes
#!/bin/bash
# 0/5 * * * * $HOME/Code/autophoto.sh >> /dev/null
if [ ! -d "$HOME/Pictures/AutoPhotos/screen/$(date +%Y%m%d)/" ]; then
mkdir -p "$HOME/Pictures/AutoPhotos/screen/$(date +%Y%m%d)/"
fi
if [ ! -d "$HOME/Pictures/AutoPhotos/picz/$(date +%Y%m%d)/" ]; then
mkdir -p "$HOME/Pictures/AutoPhotos/picz/$(date +%Y%m%d)/"
fi
@DNA
DNA / combined_ordered_enumerator.rb
Last active July 27, 2017 20:12
Create an enumerator that receives N enumerators and sort then
# The aim of this class is to take a number of ordered enumerators and then
# create an Enumerator that emits their values in ascending order.
#
# Some assumptions:
# * The enumerators passed in emit their values in ascending order.
# * The enumerators emit values which are Comparable[1] with each other.
# * The enumerators can be finite *or* infinite.
#
# You can run the test suite with: `ruby combined_ordered_enumerator.rb`.
class CombinedOrderedEnumerator < Enumerator
@DNA
DNA / cpf.rb
Created March 9, 2017 17:08
Generate random valid CPFs
#! /usr/bin/env ruby
# Setup initial variables
number = Random.new
cpf = []
vd1 = 0
vd2 = 0
# Generate the 9 first numbers
1.upto(9) do |i|
@DNA
DNA / bootstrap_shortcodes.php
Created June 7, 2017 04:05
WP shortcodes to apply bootstrap grid
<?php
// [col size="foo-value"]
// Create the function that will handle the shortcode
function grid_column($attributes, $content = null) {
// shortcode_atts is used to define default attribute values
$attributes = shortcode_atts(array('size' => '12'), $attributes);
// keep applying shortcodes to content
$content = do_shortcode($content);
@DNA
DNA / books.md
Last active July 19, 2021 13:25
[WIP] Lista de leituras essenciais de TI

Lista de leituras essenciais de TI.

Antigamente eu achava que livros de TI não valiam a pena pois ficavam obsoletos rapidamente. Com o tempo e a experiência percebi que não bem assim, e diversos livros que se focam mais em conceitos do que em linguagens tendem a durar por muito tempo.

Com base nisso, reuni os melhores livros que li e as indicações de algins amigos e começei esta lista de leituras para reunir essas ideias que continuam atuais mesmo nos dias de hoje.

Para não ficar apenas uma lista sem contexto, cada item possui uma breve explicação sobre o porque dele estar nesta lista. E claro, toda nova indicação é bem vinda! :D

@DNA
DNA / healthcheck.html
Created October 20, 2017 19:02
check if url is available
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script>
document.onreadystatechange = () => {
if (document.readyState === 'complete') {