This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Determine if the current directory is a GIT repo | |
# and print out '*' if there are changes to be committed | |
iz_git_dirty() { | |
#IZ_GIT=`git status 2>/dev/null` | |
IZ_DIRTY=`git status 2>/dev/null | grep 'nothing to commit (working directory clean)'` | |
#if [ "." != "$IZ_GIT." ]; then | |
if [ "." == "$IZ_DIRTY." ]; then | |
echo '*' | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Este script basea-se no número de alterações ocorridas no arquivo para, se for ZERO, fazer um 'git checkout <filename>' | |
# Isto foi necessário pois fiz uma cópia do repositório de um HD antigo para o novo e quando executei 'git status' apareceram TODOS os arquivos como diferença | |
# então precisei saber quais realmente continham diferenças. | |
# Execute-o na base do seu reposório git. | |
# LICENSE: MIT | |
# Author: Sérgio Berlotto <[email protected]> | |
FILES=`git diff --name-only` | |
regex='^([1-9]*).+/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reltime(date, compare_to=None, at='@'): | |
r'''Takes a datetime and returns a relative representation of the | |
time. | |
:param date: The date to render relatively | |
:param compare_to: what to compare the date to. Defaults to datetime.now() | |
:param at: date/time separator. defaults to "@". "at" is also reasonable. | |
>>> from datetime import datetime, timedelta | |
>>> today = datetime(2050, 9, 2, 15, 00) | |
>>> earlier = datetime(2050, 9, 2, 12) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/bash | |
#echo 'Obtendo senha do ddg...'; | |
#senha=`wget -q --no-check-certificate -O - \ | |
# https://duckduckgo.com/?q=password+10 | \ | |
# sed -e 's/.*class="zero_click_answer">//' -e 's/ .*//'`; | |
echo 'Obtendo senha do /dev/urandom'; | |
senha=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 10`; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Asynchronous requests in Flask with gevent""" | |
from time import time | |
from flask import Flask, Response | |
from gevent.pywsgi import WSGIServer | |
from gevent import monkey | |
import requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
from copy import deepcopy | |
def excel_columns(max_lenght=None): | |
""" | |
This method maps the excel columns names with a simple index, | |
Ex: | |
{0: 'A', 1: 'B', 2: 'C', 3: 'D', 4: 'E', ... | |
26: 'AA', 27: 'AB', 28: 'AC', 29: 'AD', 30: 'AE', ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import with_statement | |
import os | |
import re | |
import shutil | |
import subprocess | |
import sys | |
import tempfile | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script feito em python 3.5 | |
# Criado por: André Luis (http://pastebin.com/naiheub8) | |
# Validador e gerador de cpf(válidos) - criado com o objetivo de testes de software. | |
# Qualquer critica é bem vinda. | |
###################################################################################### | |
import random | |
############ VALIDADOR DE CPF ########## | |
def validador(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
# Install venv by `virtualenv --distribute venv` | |
# Then install depedencies: `source venv/bin/active` | |
# `pip install -r requirements.txt` | |
activate_this = '/var/www/apache/csshat.com/csshat.com/venv/bin/activate_this.py' | |
execfile(activate_this, dict(__file__=activate_this)) | |
path = os.path.join(os.path.dirname(__file__), os.pardir) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
#----------------------------------------------------# | |
# Title: Separador de Fotos | |
# Author: Sérgio Berlotto <[email protected]> | |
# Date: 28/Fev/2016 | |
# Script que percorre um diretório, recursivamente e | |
# deposita em outro diretório, organizado por ano/mes | |
# somente arquivos de imagem (jpg/png/jpeg/gif) | |
# | |
# Usage: separafotos.py /diretorio/de/origem /diretorio/de/destino |