Skip to content

Instantly share code, notes, and snippets.

View rg3915's full-sized avatar
🏠
Working from home

Regis Santos rg3915

🏠
Working from home
View GitHub Profile
@rg3915
rg3915 / example.cpp
Created October 11, 2015 02:05
Do While example
// Exemplo de Do While.
// Executa a ação, depois pergunta.
// Verifica se um número é zero, depois se é par ou impar.
int n;
do {
scanf ("%d", &n);
if (n!=0) {
if (n%2==0) printf ("par");
@rg3915
rg3915 / imagemagick.sh
Created October 24, 2015 02:08
Edit images with ImageMagick
# Redimensiona a figura
convert figura1.eps figura1.pdf
convert figura2.jpg figura2.pdf
convert figura3.png figura3.pdf
# Ajusta a resolução da figura
convert -density 300 figura.jpg figurafinal.jpg
# Aplica um filtro de normalização na figura
convert -normalize figura.jpg
@rg3915
rg3915 / gen_random_values.py
Last active August 16, 2022 06:34
Generate random values with Python gen_random faker gen_date fake gen date fake
import string
from datetime import date, datetime, timedelta
from decimal import Decimal
from random import choice, randint, random, randrange
import pytz
from django.utils.text import slugify
from faker import Faker
utc = pytz.UTC
@rg3915
rg3915 / nome_cap.md
Last active March 28, 2024 11:52
Colocar a primeira letra de cada palavra em maiúsculo, exceto em preposições 'da', 'de', 'di', 'do', 'du', 'para' ... - nome - pyladies - python

Tratar nomes com preposições

PyLadiesSP

Objetivo: colocar a primeira letra de cada palavra em maiúsculo, exceto em preposições 'da', 'de', 'di', 'do', 'du', 'para' ...

Texto: minicurso de python para mulheres

Resultado esperado: Minicurso de Python para Mulheres

@rg3915
rg3915 / anp_crawler.py
Created December 1, 2015 01:45 — forked from luzfcb/anp_crawler.py
Implementação simples de um Crawler pra extrair dados do site a ANP
# coding=utf-8
"""
**Implementa um Webcrawler para extracao de dados da pesquisa de media de precos realizada periodicamente pela ANP**
Desenvolvido por Fabio C. Barrionuevo da Luz. - 2013
Simple crawler to ANP site
Copyright (C) 2013 Fabio C. Barrionuevo da Luz.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
@rg3915
rg3915 / setup.sh
Last active August 5, 2023 15:36
Shell script to create a simple Django project.
# Shell script for create a simple Django project.
# wget --output-document=setup.sh https://goo.gl/pm621U
# Type the following command, you can change the project name.
# source setup.sh myproject
# Colors
red=`tput setaf 1`
green=`tput setaf 2`
@rg3915
rg3915 / _xmacroplay.md
Last active June 29, 2022 07:41
xmacroplay usage example.

#xmacroplay

Exemplo de uso do xmacroplay.

Usage:

sudo apt-get install xmacro
sudo apt-get install vim
wget --output-document=xmacroexample.sh https://goo.gl/Xt9KkU
@rg3915
rg3915 / colorbrewer.js
Last active March 17, 2018 02:09 — forked from MaxMorais/colorbrewer.js
D3 colorbrewer.js
// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
var colorbrewer = {YlGn: {
3: ["#f7fcb9","#addd8e","#31a354"],
4: ["#ffffcc","#c2e699","#78c679","#238443"],
5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
},YlGnBu: {
@rg3915
rg3915 / colorbrewer.js
Last active January 8, 2016 03:15
Relationship make with D3js
// This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
var colorbrewer = {YlGn: {
3: ["#f7fcb9","#addd8e","#31a354"],
4: ["#ffffcc","#c2e699","#78c679","#238443"],
5: ["#ffffcc","#c2e699","#78c679","#31a354","#006837"],
6: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],
7: ["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
8: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],
9: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]
},YlGnBu: {
@rg3915
rg3915 / bootstrap.sh
Created January 16, 2016 14:34 — forked from cuducos/bootstrap.sh
Computer Bootstraps
#!/bin/bash
##############################################################################
# Install system packages #
##############################################################################
# if apt-get exists, probably it's a Linux
if which apt-get > /dev/null; then
# update & clean up