Skip to content

Instantly share code, notes, and snippets.

Leonardo Prado DNA

Block or report user

Report or block DNA

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DNA
DNA / blocks.rb
Last active Dec 20, 2019
Just tinkering with some algorithms to solve a nonogram
View blocks.rb
#! /usr/bin/env ruby
require 'matrix'
# puts "▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐░▒▓▔▕▖▗▘▙▚▛▜▝▞▟"
EMPTY = ' '
BLOCK = '░'
BOX = '█'
@DNA
DNA / sprint.md
Created Aug 6, 2019
Tasks a serem feitas na implementação do sistema
View sprint.md

Tasks sigesf

Estrutura de features/stories/tasks para a implantação do novo sigesf na prefeitura de SJRP

Feature: Integração

Para receber os dados da prefeituras, diversos endpoints devem ser estruturados para receber e/ou enviar os dados do sistema.

São 19 endpoints, onde cada dado recebido e/ou enviado ficará registrado em uma tabela para registro das transações. A estrutura dessas tabelas se encontra no documento 403_Estrutura_Interface_EMPRO_ACTO 3.5.pdf

A validação, registro e manipulação dos dados deve ser feitas no sistema sigesf-integrador antes de enviar os dados ao sigesf

@DNA
DNA / cpf.js
Created Aug 24, 2018
JS CPF validation
View cpf.js
#! /usr/bin/env node
function validate_cpf(strCPF) {
if (new Set(strCPF).size == 1) return false
cpf = Array.from(strCPF).map(Number);
return [9, 10].every(pos => {
multiplier = pos + 1
@DNA
DNA / stats.py
Created Jul 2, 2018
Stats class for Renpy
View stats.py
class Stat(object):
class Delta(object):
def __init__(self, parent):
self.parent = parent
self.value = parent.value
def __repr__(self):
return '<Stat.Delta value={}>'.format(self.calculate())
def __str__(self):
@DNA
DNA / worktime.rb
Last active Jul 30, 2018
check when its time to go home
View worktime.rb
#! /usr/bin/env ruby
# ./worktime 10:12 [13:06] [14:15] [19:40]
now = Time.now
expected_work_time = 28800
if ARGV[0].nil?
puts 'Você precisa fornecer ao menos o horário de entrada'
exit 1
@DNA
DNA / twitch_collection_download.rb
Created May 1, 2018
Pass a Twitch collection URL as an argument and it'll download all of them
View twitch_collection_download.rb
#! /usr/bin/env ruby
require 'net/http'
require 'json'
require 'tempfile'
download_list = Tempfile.new
CLIENT_ID = 'TWITCH_CLIENT_ID'
collection_id = ARGV.first.split('/').last
twitch_uri = URI("https://api.twitch.tv/kraken/collections/#{collection_id}/items")
@DNA
DNA / fib_generator.js
Created Apr 16, 2018
trying a fibonnacci generator with js closures
View fib_generator.js
function fibGenerator() {
prev1 = 0
prev2 = 1
function next() {
result = prev1 + prev2
prev1 = prev2
prev2 = result
return prev2
}
return next;
View count_intersection.rb
#!/usr/bin/env ruby
# Given 2 sorted arrays with unique values and arbitrary size, count the
# intersection values between them
array_a = [1, 2, 4, 5, 7, 8]
array_b = [0, 1, 3, 4, 6, 7, 9]
index_a = index_b = count = 0
loop do
@DNA
DNA / loop_bg.rpy
Created Feb 7, 2018
Create a looping bg on the say screen
View loop_bg.rpy
# Create the Image ATL
image loop_bg:
"bg one"
time 1.0
"bg two"
time 1.0
repeat
# Add it as a background on screen window
# If you are using the default screen.rpy, there's probably a style
@DNA
DNA / healthcheck.html
Created Oct 20, 2017
check if url is available
View healthcheck.html
<!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') {
You can’t perform that action at this time.