Skip to content

Instantly share code, notes, and snippets.

View erichnascimento's full-sized avatar
🚧
Building the next big thing

Erich Nascimento erichnascimento

🚧
Building the next big thing
View GitHub Profile
@erichnascimento
erichnascimento / youcloud.py
Last active December 19, 2015 18:59
Exemplo consumo YouCloud webservice
#!/usr/bin/env python
# -*- coding: latin-1 -*-
import urllib
import urllib2
import json
# Autentica na plataforma YouCloud e retorna a string com o AuthKey
# Use o authKey para requisicoes posteriores que requerem autenticação
def authenticate(url, crendential):
@erichnascimento
erichnascimento / selecty-webservice.php
Last active August 29, 2015 14:02
Exemplo de consumo do webservice do Selecty via PHP/JSON
#!/usr/bin/env php
<?php
/**
* Exemplo de consumo Selecty webservices
*
* @author Erich Nascimento <[email protected]>
* @copyright Youse Technologies
*/
// URL Base
@erichnascimento
erichnascimento / gnome-bg-carrousel.sh
Created July 26, 2014 04:15
A simple gnome desktop background changer even given time
#!/usr/bin/env bash
# author: Erich Nascimento <[email protected]>
# created: 2014-07-26 01:25
# TODO: Implements transitions maybe using gsettings ... picture-opacity
#
# references:
# - Inspiration: http://askubuntu.com/a/69500/184517
# - Scripting approach: https://github.com/visionmedia/n/blob/master/bin/n
# - Sleep: http://www.cyberciti.biz/faq/linux-unix-sleep-bash-scripting/
Moved to: http://github.com/gf3/dotfiles/blob/master/bash_prompt
#
# Fix Dual Monitors in GNOME 3
# Ref: http://gregcor.com/2011/05/07/fix-dual-monitors-in-gnome-3-aka-my-workspaces-are-broken/
#
gsettings set org.gnome.shell.overrides workspaces-only-on-primary false
@erichnascimento
erichnascimento / first-row-each-group.sql
Created September 17, 2015 20:15
Select first row in each GROUP BYgroup
/*
On Oracle 8i+, SQL Server 2005+, PostgreSQL 8.4+, DB2, Firebird 2.1+, Teradata, Sybase, Vertica:
*/
WITH summary AS (
SELECT p.id,
p.customer,
p.total,
ROW_NUMBER() OVER(PARTITION BY p.customer
ORDER BY p.total DESC) AS rk
FROM PURCHASES p)
#!/usr/bin/env bash
# Reference: https://ask.fedoraproject.org/en/question/9111/sticky-what-plugins-do-i-need-to-install-to-watch-movies-and-listen-to-music/
#
# Set up the repositories
#
sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
#
# Install minimal
@erichnascimento
erichnascimento / Amazon EC2 tunnel.sh
Created February 3, 2016 16:46
Using Amazon EC2 instance as proxy
# Add PEM key
ssh-add my-key.pem
# Open a local tunnel for all interfaces, using port 6352
ssh -D 0.0.0.0:6352 -f -C -q -N [email protected]
package main
import (
"fmt"
"log"
"math/rand"
"time"
)
var massas = []string{"fina", "media", "grossa"}
@erichnascimento
erichnascimento / carta-contribuicao-sindical.txt
Created June 16, 2016 20:31
Modelo de carta para não autorizar o desconto da contribuição sindical
Ao Sindicato __
Assunto: CONTRIBUIÇÃO CONFEDERATIVA/CONTRIBUIÇÃO ASSISTENCIAL
Eu ........., portadora da carteira profissional n.º ............, CPF e RG regularmente registrada na empresa (NOME DA EMPRESA e CNPJ) com sede à (ENDEREÇO), Nº , bairro,..........., venho, informar que não concordo com o desconto referente a Contribuição Confederativa / Assistencial que veio a ser determinado pela Convenção Coletiva do Trabalho 20xx/20xx e não autorizo o desconto da mesma em folha de pagamento.
Sendo só para o momento, firmo a presente;
Assinatura do trabalhador