Skip to content

Instantly share code, notes, and snippets.

@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 é "seunome@gmail.com"
mas também pode ser "seunome+academia@gmail.com"
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
@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 / 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
<?php
$str_conn="firebird:host=localhost;dbname=/var/lib/firebird/2.5/data/employee.fdb;charset=UTF8";
$dbh = new PDO($str_conn, "sysdba", "masterkey");
?>
@leonirlopes
leonirlopes / curl-smtp-email.sh
Created March 31, 2017 12:24 — forked from james2doyle/curl-smtp-email.sh
Send SMTP email using cURL
curl --connect-timeout 15 -v --insecure "smtp://smtp.example.com:25" -u "username:password"
\ --mail-from "sender@example.com" --mail-rcpt "destination@example.com"
\ -T email-contents.txt --ssl
@leonirlopes
leonirlopes / delete-targz.php
Created March 23, 2017 11:53 — forked from Xeroday/delete-targz.php
Deletes .tar.gz files older than 7 days.
<?php
$files = glob("*.tar.gz");
foreach($files as $file) {
if(is_file($file)
&& time() - filemtime($file) >= 7*24*60*60) { // 7 days
unlink($file);
}
}
?>
<?php
if (function_exists("date_default_timezone_set")) {
date_default_timezone_set("UTC");
}
function simple() {
$a = 0;
for ($i = 0; $i < 1000000; $i++)
$a++;
@leonirlopes
leonirlopes / ckeditor-responsive-images.js
Created March 16, 2017 17:12 — forked from fabiomaggio/ckeditor-responsive-images.js
Make inserted images in CKEditor automatically responsive
// If you want inserted images in a CKEditor to be responsive
// you can use the following code. It creates a htmlfilter for the
// image tag that replaces inline "width" and "style" definitions with
// their corresponding attributes and add's (in this example) the
// Bootstrap "img-responsive" class.
CKEDITOR.on('instanceReady', function (ev) {
ev.editor.dataProcessor.htmlFilter.addRules( {
elements : {
img: function( el ) {
// Add bootstrap "img-responsive" class to each inserted image
@leonirlopes
leonirlopes / php-html-css-js-minifier.php
Created March 15, 2017 20:56 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
// Based on <https://github.com/mecha-cms/extend.minify>
define('MINIFY_STRING', '"(?:[^"\\\]|\\\.)*"|\'(?:[^\'\\\]|\\\.)*\'');
define('MINIFY_COMMENT_CSS', '/\*[\s\S]*?\*/');
define('MINIFY_COMMENT_HTML', '<!\-{2}[\s\S]*?\-{2}>');
define('MINIFY_COMMENT_JS', '//[^\n]*');
define('MINIFY_PATTERN_JS', '\b/[^\n]+?/[gimuy]*\b');
define('MINIFY_HTML', '<[!/]?[a-zA-Z\d:.-]+[\s\S]*?>');
@leonirlopes
leonirlopes / stream_to_youtube.sh
Created February 23, 2017 17:05 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube