Skip to content

Instantly share code, notes, and snippets.

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

Diego Ponciano diegoponciano

🏠
Working from home
  • Sao Paulo - Brazil
View GitHub Profile
By Klaus Wuestefeld
1) Torne-se excelente.
Seja realmente bom em alguma coisa. Não fique só choramingando ou
querendo progredir às custas dos outros. Não pense q pq vc sentou 4
anos numa faculdade ouvindo um professor falar sobre software q vc
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo
aula. Ele pratica. Instrumentistas geniais nao aprendem a tocar tendo
aula. Eles praticam. Pratique. Chegue em casa depois do trabalho e da
@diegoponciano
diegoponciano / gist:1514313
Created December 23, 2011 14:12 — forked from sontek/snowjob.sh
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
declare -A snowflakes
declare -A lastflakes
clear
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
# html template
{% form_from_page slug %}
# template tag
from mezzanine import template
from mezzanine.forms.forms import FormForForm
from mezzanine.pages.models import Page
register = template.Library()
@diegoponciano
diegoponciano / dump.sql
Last active August 29, 2015 14:12 — forked from manfe/dump.sql
-- Os dados contidos nesse arquivo foram extraídos do site: http://ibge.gov.br/cidadesat utilizando ruby, nokogiri e expressões regulares.
-- Autor: Mauricio Natanael Ferreira
-- Github: https://github.com/manfe
-- Twitter: @manfe01
-- Email: contato [at] ferreiramauricio [dot] com
-- ***********************************************************************************************************************************************
-- id ...
# Create a new working directory and cd into it
~$ mkdir -p /path/n4update && cd /path/n4update
# Download all files you need
/path/n4update$ wget --no-check-certificates https://dl.google.com/dl/android/aosp/occam-lrx22c-factory-86c04af6.tgz
# Download openrecovery-twrp-2.8.3.2-mako.img from http://techerrata.com/browse/twrp2/mako to the same path
# Download CF-Auto-Root-mako-occam-nexus4.zip from http://autoroot.chainfire.eu to the same path
# Extract downloaded file archives
/path/n4update$ mkdir -p ./images && tar zxvf occam-lrx22c-factory-86c04af6.tgz -C ./images
@diegoponciano
diegoponciano / cpf.py
Last active August 29, 2015 14:27 — forked from juanplopes/cpf.py
def next_digit(value, base):
return value + str(sum(int(a)*b for a,b in zip(value, base))%11%10)
def make_valid(value, ap2, base):
return next_digit(next_digit(value, base), ap2+base)
def numbers_only(string):
return ''.join([s for s in string if s.isdigit()])
def is_valid_cpf(cpf):
#!/bin/bash
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
#
# See also:
# - http://stackoverflow.com/questions/4581727/convert-sqlite-sql-dump-file-to-postgresql
# - https://gist.github.com/bittner/7368128
@diegoponciano
diegoponciano / dump.sh
Last active December 16, 2016 11:06 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
@diegoponciano
diegoponciano / install-telegram.sh
Last active June 2, 2017 15:41 — forked from slavafomin/install-telegram.sh
Install Telegram on Ubuntu using shell automatically
#!/bin/bash
set -o errexit
set -o pipefail
shopt -s nullglob
INSTALL_PATH="$HOME/opt/Telegram"
TEMP_PATH="$HOME/.tmp"
sudo apt-get install exo-utils xz-utils