Skip to content

Instantly share code, notes, and snippets.

View jonathanpmartins's full-sized avatar
🏠
Working from home

Jonathan Prass Martins jonathanpmartins

🏠
Working from home
View GitHub Profile
@dragonfire1119
dragonfire1119 / install-openwrt-on-proxmox.md
Last active March 6, 2024 21:33
Install OpenWRT on Proxmox
@sistematico
sistematico / feriados.json
Last active January 28, 2024 00:16
Json com os feriados nacionais
{
"2001-01-01": "Confraternização Universal",
"2001-02-27": "Carnaval",
"2001-04-13": "Paixão de Cristo",
"2001-04-21": "Tiradentes",
"2001-05-01": "Dia do Trabalho",
"2001-06-14": "Corpus Christi",
"2001-09-07": "Independência do Brasil",
"2001-10-12": "Nossa Sr.a Aparecida - Padroeira do Brasil",
"2001-11-02": "Finados",
@jacopotediosi
jacopotediosi / block-tor-exit-nodes-fail2ban.md
Last active February 16, 2024 06:52
Block Tor Exit Nodes with Fail2ban

Below is the procedure to automate the ip ban of tor exit nodes with fail2ban.

  1. Install fail2ban:
sudo apt install fail2ban
  1. Create a new fail2ban jail (editing /etc/fail2ban/jail.local):
[tor]
@nfsarmento
nfsarmento / nginx-block-tor-ip.sh
Created December 27, 2019 13:58
nginx block tor
wget -qO- https://check.torproject.org/exit-addresses | grep ExitAddress | cut -d ' ' -f 2 | sed "s/^/deny /g; s/$/;/g" > /etc/nginx/conf.d/tor-block.conf; systemctl reload nginx
#next add the following to your nginx site conf
#In nginx you then just include the blacklist.
include /etc/nginx/conf.d/tor-block.conf;
#The file contains statements like this:
@nico-lab
nico-lab / h264_nvenc.txt
Last active April 3, 2024 11:16
ffmpeg -h encoder=h264_nvenc
Encoder h264_nvenc [NVIDIA NVENC H.264 encoder]:
General capabilities: dr1 delay hardware
Threading capabilities: none
Supported hardware devices: cuda cuda d3d11va d3d11va
Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 bgra rgb0 rgba x2rgb10le x2bgr10le gbrp gbrp16le cuda d3d11
h264_nvenc AVOptions:
-preset <int> E..V....... Set the encoding preset (from 0 to 18) (default p4)
default 0 E..V.......
slow 1 E..V....... hq 2 passes
medium 2 E..V....... hq 1 pass
@alexweissman
alexweissman / BelongsToManyThrough.php
Last active May 12, 2023 07:58
Custom BelongsToManyThrough relationship for Laravel/Eloquent
<?php
/**
* UserFrosting (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/UserFrosting
* @copyright Copyright (c) 2013-2017 Alexander Weissman
* @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
*/
namespace UserFrosting\Sprinkle\Core\Model\Relations;
@deleugpn
deleugpn / DuskServeCommand.php
Last active April 27, 2024 15:04
Run php artisan serve before running php artisan dusk in a single console command.
<?php
namespace App\Console\Commands;
use RuntimeException;
use Laravel\Dusk\Console\DuskCommand;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ProcessBuilder;
class DuskServeCommand extends DuskCommand {
@tiagoad
tiagoad / block-tor.sh
Created July 21, 2016 10:40
Cronjob to block tor exit nodes with nginx on debian 8 jessie
wget -qO- https://check.torproject.org/exit-addresses | grep ExitAddress | cut -d ' ' -f 2 | sed "s/^/deny /g; s/$/;/g" > /etc/nginx/conf.d/tor-block.conf; systemctl reload nginx
@rbarilani
rbarilani / subsetSum.js
Created September 12, 2015 20:07
Finding all possible combinations of numbers to reach a given sum ()
function subsetSum(numbers, target, partial) {
var s, n, remaining;
partial = partial || [];
// sum partial
s = partial.reduce(function (a, b) {
return a + b;
}, 0);
@cristianobecker
cristianobecker / search-files.sh
Last active December 30, 2016 04:24
Fast way to search in files in small projects
search-files() {
local folder=$(test $# -eq 2 && echo "$1" || echo .)
local query=$(test $# -eq 2 && echo "$2" || echo "$1")
local IFS=$'\n'
for f in $(find "$folder" -type f); do
local result=$(
cat "$f" |
GREP_COLOR='01;32' egrep --color=always -n "$query" |
GREP_COLOR='01;33' egrep --color=always "^\d+:"