Skip to content

Instantly share code, notes, and snippets.

View gusanthiago's full-sized avatar

Gustavo Santos Thiago gusanthiago

View GitHub Profile
/**
* b64
* @description - converte texto ou objeto para base64
*
* @param {Object[]} - objeto DOM de entrada
*
* @return base64 do grafico
*/
var b64 = function(obj){
@gusanthiago
gusanthiago / getImage.rb
Created April 12, 2017 01:20
Requisita uma imagem de um dominio e salva
require 'net/http'
port = 8080
Net::HTTP.start("domain", port) do |http|
resp = http.get("/img/cam.jpg")
open("file_name.jpg", "wb") do |file|
file.write(resp.body)
end
end
@gusanthiago
gusanthiago / intercambio-ordenacao.cpp
Created April 24, 2017 02:54
maratonaInterna2015fatecsjc-algunsexers
#include <bits/stdc++.h>
using namespace std;
typedef struct {
double nota;
int falta;
string nome;
}aluno;
@gusanthiago
gusanthiago / getImageOpenUri.rb
Created May 17, 2017 07:57
Image get and save open uri
require 'open-uri'
open('file_name_uri.png', 'wb') do |file|
file << open('https://uva.onlinejudge.org/templates/hm_yaml_2_5/img/onlinejudgelogo2.png').read
end
@gusanthiago
gusanthiago / getFile.py
Created May 26, 2017 18:34
Modificado arquivo de exemplo do pdfminer para ler um pdf do banco central
"""
Extract PDF text using PDFMiner. Adapted from
http://stackoverflow.com/questions/5725278/python-help-using-pdfminer-as-a-library
"""
# nao esqueca de instalar a biblioteca Pedro
# modificado de acordo com a doc == https://github.com/euske/pdfminer/
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter#process_pdf
from pdfminer.pdfpage import PDFPage
from pdfminer.converter import TextConverter
@gusanthiago
gusanthiago / belajornada.cpp
Created May 27, 2017 14:22
Questoes parcialmente aceitas
#include <bits/stdc++.h>
using namespace std;
#define maxn 100010
const int inf = 0x3f3f3f3f;
int main () {
int n;
int nova;
vector<int> numeros;
@gusanthiago
gusanthiago / novocatarata.cpp
Last active June 10, 2017 16:55
Teste mochila
#include <bits/stdc++.h>
using namespace std;
#define maxn 200010
vector <int> pesos,valores;
int c = 0;
int pd[1000100][200100];
@gusanthiago
gusanthiago / labels-drink.json
Last active June 21, 2017 04:19
Labels drink
{
"brands": [
{
"name":"Adriatica"
},
{
"name":"Antarctica"
},
{
"name":"Antarctica Sub Zero"
@gusanthiago
gusanthiago / regex-card-test.js
Created July 12, 2017 13:47
Testing credit cards
/**
* Regex credit card numbers test
*
* author <gusanthiagodv@gmail>
*/
const cardCompanies = [
{name: 'visa', pattern: /^4[0-9]{15}$/},
{name: 'master', pattern: /^5[0-5][0-9]{14}$|2[2-6][0-9]{14}$|271[0-9]{13}$|2720[0-9]{12}/},
{name: 'american_express', pattern: /^3[47][0-9]{13}$/},
{name: 'diners_club', pattern: /^3(0[0-5]|[68]\d)\d{11}$/},
#include <bits/stdc++.h>
using namespace std;
#define huge unsigned long long
huge mulmod(huge a, huge b, huge c)
{
huge x = 0, y = a%c;
while(b>0)
{