Skip to content

Instantly share code, notes, and snippets.

View lvitals's full-sized avatar

Leandro Vital lvitals

View GitHub Profile

Como configurar o Packet Filter (PF) no FreeBSD 12.1

Introdução

O firewall é, provavelmente, uma das linhas de defesa mais importantes contra os ataques cibernéticos. A capacidade de configurar um firewall do zero é uma habilidade capacitadora que permite que administradores assumam o controle de suas redes.

Packet Filter (PF) é um aplicativo de firewall renomado mantido pelo OpenBSD, um projeto orientado para segurança. Ele é mais precisamente apresentado como uma ferramenta de filtragem de pacotes, por isso o seu nome, e ele é conhecido por sua sintaxe simples, amigável e de recursos amplos. O PF é um firewall dinâmico por padrão, que armazena as informações sobre conexões em uma state table, que pode ser acessada para fins analíticos. O PF faz parte do sistema base do FreeBSD e tem sup

@lvitals
lvitals / 0-transmission-cli.md
Last active March 2, 2020 01:59
Quick and easy way of making Chrome/Chromium send bittorrent magnet links to transmission-cli with xdg.

Quick and easy way of making Chrome/Chromium send bittorrent magnet links to a remote Transmission-Cli with xdg. Chrome/Chromium does not handle default applications, instead relying on the OS to manage that. The default handler is xdg, which maps the MIME type to the default application. Extra tooling is required because xdg requires a registered desktop file, so you can't simply give it a command to run.

Steps:

  1. You will need xterm and transmission-cli, I did the procedure on Arch Linux, can be adapted for other distributions. sudo pacman -S xterm transmission-cli

  2. Install the shell script transmission ideally in /usr/local/bin sudo cp transmission /usr/local/bin/ sudo chmod +x /usr/local/bin/transmission

@lvitals
lvitals / README.md
Created March 2, 2019 14:35 — forked from miguelmota/README.md
Multiple accounts with Mutt E-Mail Client (gmail example)

How to set up multiple accounts with Mutt E-mail Client

Thanks to this article by Christoph Berg

Instructions

Directories and files

~/
@lvitals
lvitals / svg2ico.sh
Created May 30, 2018 13:51 — forked from azam/svg2ico.sh
Convert SVG to ICO using ImageMagick, with transparent background and multi-size icons
convert -density 384 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico
@lvitals
lvitals / gchart_offline.html
Created October 3, 2017 19:38 — forked from makevoid/gchart_offline.html
GChart offline example
<!--
How to use Google JS Visualization Api offline, step by step
this approach might work with other libraries loaded with google.load, after all it's still JavaScript!!!
-->
<!DOCTYPE html>
<html>
@lvitals
lvitals / README.md
Created August 11, 2017 18:15 — forked from hbpasti/README.md
fontawesome with i3status

fontawesome with i3status

This is my i3 config, using FontAwesome icons for i3status.

Save files to ~/.i3.

@lvitals
lvitals / gist:0f3e3f2ea499fe6fad920b69655bef6a
Last active May 22, 2017 12:46
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.

@lvitals
lvitals / RubyRails.md
Last active April 26, 2017 17:55
Aprenda Ruby On Rails

É difícil falar de Ruby sem mencionar seu framework web mais famoso, Ruby on Rails. Mas não adianta muito encarar o framework sem um prévio estudo da linguagem (o que de fato já observei acontecer inúmeras vezes). Esse post tem como intuito auxiliar na aprendizagem tanto da linguagem como do framework, para evitar que erros comuns como esse tornem a utilização de ambos um desastre.

Ruby

Ruby é uma linguagem de programação que apareceu para o mundo em 1995, criada por Yukihiro "Matz" Matsumoto. Tem como características o fato de ser uma linguagem de uso geral, com tipagem dinâmica e forte, orientada a objetos e que incorpora diversos paradigmas de programação, como o funcional e o imperativo.

Iniciantes

  • Ruby in Twenty Minutes - É o que o nome diz: um pequeno tutorial que promete não tomar mais do que 20 minutos do seu tempo. Se encarrega de mostrar como baixar e instalar o Ruby. Faz grande uso da IRB (Int