Skip to content

Instantly share code, notes, and snippets.

@leonirlopes
leonirlopes / desfazendo-push.md
Created December 27, 2017 17:10 — forked from davidalves1/desfazendo-push.md
Desfazendo um git push

Desfazendo um git push

Não é possível desfazer um push diretamente, como é feito com o commit utilizando o comando $ git reset --soft|mixed|hard hash-do-penultimo-commit

Para desfazer um push são necessários 3 passos:

  1. Utilizar o comando $ git reset --mixed hash-do-penultimo-commit e em seguida utilizar o comando $ git stash
  2. Utilizar o comando $ git revert hash-do-ultimo-commit
  3. Utilizar o comando $ git stash apply
@leonirlopes
leonirlopes / key.vbs
Created February 28, 2018 20:04
Obtenha as Chaves de Produto do Windows e Office
' GetProductKeys.VBS v1.0 by Foolish IT
Const HKEY_LOCAL_MACHINE = &H80000002
WinKey = GetWinKey
OfficeKeys = GetOfficeKey("10.0") & GetOfficeKey("11.0") & GetOfficeKey("12.0") & GetOfficeKey("14.0") & GetOfficeKey("15.0")
If Msgbox(WinKey & vbnewline & vbnewline & OfficeKeys & vbnewline & "Save All Keys to ProductKeys.txt?", vbyesno, "GetProductKeys.VBS by Foolish IT") = vbyes then
Set objFSO = CreateObject("Scripting.FileSystemObject")
@leonirlopes
leonirlopes / gist:24b66225ae961ce4f6fb3ffafa3f6219
Created April 2, 2018 18:08
Descobrindo a origem do SPAM
O GMail possui um filtro que permite que você receba e-mails informando o seu e-mail e uma palavra antes da mesma
Exemplo:
seu e-mail é "[email protected]"
mas também pode ser "[email protected]"
isso é fantástico não acha?
Mas agora é a dúvida, como fazer isso no cPanel?
Vá em "Filtro por nível de conta", depois em clique em "Criar um Novo Filtro"
defina um nome para este filtro
<?php
// veja em funcionamento ~~> https://ideone.com/IMDNHT
// defino a data de hoje
$ano = date('Y');
$mes = date('m');
$dia = date('d');
// calculo uma senha de 6 digítos com base na data
$senha = substr((substr($ano, -2) * $mes * $dia * ($ano - 1900) * 6666), -6);
@leonirlopes
leonirlopes / mask.php
Created April 20, 2018 19:32
Máscara PHP para CNPJ, CPF, Data e qualquer outra coisa
<?php
// PHP Máscara CNPJ, CPF, Data e qualquer outra coisa
// http://blog.clares.com.br/php-mascara-cnpj-cpf-data-e-qualquer-outra-coisa/
// ver em funcionamento ~~> https://ideone.com/wP7zN2
function mask($val, $mask)
{
$maskared = '';
$k = 0;
@leonirlopes
leonirlopes / valida-cpf.php
Last active April 21, 2018 17:09
Script para Validar CPF em PHP
<?php
function validaCPF($cpf = null)
{
// Verifica se um número foi informado
if (empty($cpf)) {
return false;
}
// Elimina possivel mascara
$cpf = preg_replace('/[^0-9]/', '', $cpf);
@leonirlopes
leonirlopes / letsencrypt-proxmox.md
Created September 7, 2020 14:09 — forked from lichti/letsencrypt-proxmox.md
Proxmox with letsencrypt ssl
git clone https://github.com/certbot/certbot /opt/letsencrypt
ln -s /opt/letsencrypt/certbot-auto /usr/bin/certbot
certbot certonly --expand --agree-tos --text --non-interactive \
 --standalone \
@leonirlopes
leonirlopes / linux-kill-pts.md
Created September 21, 2020 18:38 — forked from holmberd/linux-kill-pts.md
Kill tty/pts sessions in Linux

Kill user tty/pts sessions in Linux

Commands

  • w: show who is logged on and what they are doing
  • who: show who is logged on
  • tty: show current users pseudo terminal
  • ps -ft pts/1: get process id for the pseudo terminal
  • pkill: signal process based on name and other attributes
// ==UserScript==
// @name BlockBlockAdBlock
// @namespace http://github.com/anka-213
// @version 0.1.1
// @description Block the BlockAdBlock script
// @author Andreas Källberg
// @match http://blockadblock.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
@leonirlopes
leonirlopes / rmhash.sh
Created March 31, 2022 14:31 — forked from apolzek/rmhash.sh
Remove files with the same hash
# by: apolzek
md5sum * | sort -n > .file
filename='.file'
n=1
x=1
while read line; do
current_hash=$(echo $line | awk {'print $1'})
echo "[debugging] current_hash: $current_hash"
x=$(($n + 1))