Skip to content

Instantly share code, notes, and snippets.

View DiegoQueiroz's full-sized avatar

Diego Queiroz DiegoQueiroz

  • São Paulo, SP, Brazil
View GitHub Profile
@echo off
@cls
set tempfile="%TEMP%\diskscrp.dsk"
echo.
echo === Disk removal tool ===
echo.
echo Select the disk volume number
echo (if the disk has multiple volumes, select any of them)
@DiegoQueiroz
DiegoQueiroz / downloadLattes.py
Created May 4, 2015 00:52
Override HTTP redirect behavior to CNPq Lattes
# -*- coding: utf-8 -*-
import sys, re
if sys.version_info.major == 3:
# usando Python 3
from urllib.request import Request, build_opener, HTTPRedirectHandler, HTTPCookieProcessor
else:
# usando Python 2
from urllib2 import Request, build_opener, HTTPRedirectHandler, HTTPCookieProcessor
@DiegoQueiroz
DiegoQueiroz / getLattes.py
Created May 29, 2015 00:09
Download a single page of CNPq Lattes
# -*- coding: utf-8 -*-
import sys
if sys.version_info.major >= 3:
# usando Python 3.x ou superior
from urllib.request import Request, build_opener, HTTPCookieProcessor
from urllib.parse import urlencode
else:
# usando Python 2.x ou anterior
from urllib2 import Request, build_opener, HTTPCookieProcessor
@DiegoQueiroz
DiegoQueiroz / nubank.sh
Created September 25, 2015 04:17
Baixar dados da fatura em aberto do Nubank.com.br (formato JSON)
#!/bin/bash
# Baixa os dados da fatura em aberto do Nubank
# Uso:
# ./nubank.sh <cpf> <senha>
cpf=$1
senha=$2
if [ "$cpf" == "" ]; then
read -p "Digite o CPF: " cpf
@DiegoQueiroz
DiegoQueiroz / nubank_password.sh
Last active February 7, 2017 20:12
Baixar a senha do cartão Nubank.com.br (formato JSON)
#!/bin/bash
# Baixa a senha do cartão Nubank
# Uso:
# ./nubank_password.sh <cpf> <senha>
cpf=$1
senha=$2
if [ "$cpf" == "" ]; then
read -p "Digite o CPF: " cpf
@DiegoQueiroz
DiegoQueiroz / RunMe.py
Last active May 17, 2018 16:50
Run a process and prepare it to terminate when it becomes orphan
# -*- coding: utf-8 -*-
# RunMe.Py
# 2018 - Diego Queiroz
#
# Usage:
# Linux : python /path/to/RunMe.py /path/to/your/your_script.sh
# Windows: C:\path\to\python.exe C:\path\to\RunMe.py C:\path\to\your_script.bat
#
import atexit
@DiegoQueiroz
DiegoQueiroz / query_activedirectory.py
Last active October 18, 2023 10:43
Python-LDAP Query Active Directory Example (with paged results to prevent ldap.SIZELIMIT_EXCEEDED exception)
# -*- coding: utf-8 -*-
# requires python-ldap (usually pip install python-ldap)
# But this package requires OpenLDAP libraries, so it is a pain to install it on Windows.
# So, if you're on Windows, I recomment to use pre-compiled binaries with this command (virtualenv supported):
# pip install https://download.lfd.uci.edu/pythonlibs/h2ufg7oq/python_ldap-3.1.0-cp37-cp37m-win_amd64.whl
import ldap
from ldap.controls import SimplePagedResultsControl
@DiegoQueiroz
DiegoQueiroz / GeraDigitosAleatorios.java
Last active July 22, 2020 20:30
Sequência de dígitos aleatórios em Java, utilizando SecureRandom
import java.security.SecureRandom;
public class Main {
public static void main(String[] args) throws Exception {
System.out.println(GeraDigitosAleatorios(8));
}
-- Para executar esse código é necessário ter acesso ao pacote DBMS_CRYPTO
-- GRANT EXECUTE ON SYS.DBMS_CRYPTO TO <seu_usuario>;
SELECT
LPAD(DBMS_CRYPTO.RANDOMNUMBER, str_size, '0') crypto_rand
FROM
(SELECT 8 str_size FROM dual); -- "8" é o tamanho da string a ser gerada
SELECT
RIGHT(ABS(CAST(CRYPT_GEN_RANDOM(str_size) AS BIGINT)), str_size) crypto_rand
FROM
(select 8 str_size) var; -- "8" é o tamanho da string a ser gerada