Skip to content

Instantly share code, notes, and snippets.

View almirb's full-sized avatar

Almir Bolduan almirb

View GitHub Profile
@almirb
almirb / m160519_152129_create_estados_e_cidades.php
Last active April 26, 2022 01:31
[Yii2][Migration] Todos os estados e cidades do Brasil
<?php
/*
* [Yii2][Migration] Todos os estados e cidades do Brasil
*
* Autor: Emanuel A. Leite (https://github.com/AnDroidEL)
* Data: 02/04/2016
*
* Ajustes: Almir Bolduan (https://github.com/almirb)
* Data: 01/09/2016
@almirb
almirb / Install_Phpstorm.sh
Last active January 29, 2018 17:06 — forked from theodorosploumis/Install_Phpstorm.sh
Update phpstorm on Ubuntu linux.
#!/bin/bash -e
# Original credits to theodorosploumis
# IMPORTANT. My phpstom installation exists on /opt/phpstorm.
if [ "$(whoami)" != "root" ]
then
echo "Sorry, you are not root."
exit 1
fi
@almirb
almirb / README.md
Last active November 26, 2023 09:13 — forked from guifromrio/compress-pdf-with-gs.md
Compress PDF files with ghostscript

Batch Compress PDF

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality. With this file you'll able to compress a bunch of PDF files at once.

Usage

First, download and install Ghostpdf (https://ghostscript.com/download/). From command prompt, run compress-pdf.md "source folder" "destination folder" e.g:

@almirb
almirb / DebugModule.php
Last active May 12, 2017 13:17
Getting Yii2 debug bar to show on user role instead of IP
<?php
namespace app\modules\sistema\components;
use Yii;
use yii\debug\Module;
/**
* Description of DebugModule
*
@almirb
almirb / PostController.php
Last active September 29, 2017 18:37 — forked from jamband/PostController.php
Yii 2: Ajax + Delete
<?php
class PostController extends Controller
{
// ...
public function actionDelete($id)
{
$this->findModel($id)->delete();
if (!Yii::$app->request->isAjax) {
return $this->redirect(['index']);
@almirb
almirb / bhaskara.html
Created November 8, 2018 18:48
Script para calcular a fórmula de Bhaskara em Javascript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Cálculo de Bhaskara </title>
<script LANGUAGE="JavaScript" type="text/javascript">
var valorA = prompt("Informe o valor de A:");
@almirb
almirb / media.html
Created November 9, 2018 01:08
Média de 2 notas usando JavaScript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Média de 2 Notas </title>
<script LANGUAGE="JavaScript" type="text/javascript">
var nota1 = parseInt(prompt("Qual a nota 1?"));
@almirb
almirb / leao_helper.user.js
Last active February 22, 2019 22:29
LeãoHelper
// ==UserScript==
// @name LeaoHelper
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Script auxiliar do aplicativo Leão.
// @author Almir Bolduan
// @include https://extratoir.inss.gov.br/irpf01/pages/consultarExtratoIR.xhtml*
// @grant none
// ==/UserScript==
@almirb
almirb / cloudflare-ban.sh
Last active December 23, 2019 17:31 — forked from bdtech/cloudflare-ban.sh
OSSEC active response to block an IP at the Cloudflare reverse proxy level who triggers errors in short time frame in Apache/nginx logs. Updated to support Cloudflare API v4.
#!/bin/sh
# Adds an IP to Cloudflare IP block list
# Path: /var/ossec/active-response/bin/cloudflare-ban.sh
# Authors: Bryan Dwyer (bdtech) and Almir Bolduan (almirb)
# Last modified: May 08, 2019
#
# Sample config (Edit /var/ossec/etc/ossec.conf):
#
# <command>
# <name>cloudflare-ban</name>
@almirb
almirb / mysql_backup.cmd
Last active January 2, 2023 22:01
MySQL Backup Batch Script (Windows) for 7 day persistence with hour prefix.
@echo off
:: make sure to change the settings from line 4-9
set dbUser=backup
set dbPassword="MyBackupUserPass"
set backupDir="C:\laragon\bkp\mysql"
set mysqldump="C:\laragon\bin\mysql\mysql-5.7.24-winx64\bin\mysqldump.exe"
set mysqlDataDir="C:\laragon\data\mysql"
set zip="C:\Program Files\7-Zip\7z.exe"