Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View viniciusdaniel's full-sized avatar

Vinicius Daniel Antunes Oliveira viniciusdaniel

View GitHub Profile
@viniciusdaniel
viniciusdaniel / SWAP-101.md
Created September 26, 2023 14:33 — forked from vpnwall-services/SWAP-101.md
[SWAP 101] Swap 101 #linux #swap #101

SWAP 101

  • Allocate swap sudo fallocate -l 1G /swapfile

  • Alternate allocation sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576

  • Perms

@viniciusdaniel
viniciusdaniel / psql-with-gzip-cheatsheet.sh
Created May 28, 2021 03:16 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@viniciusdaniel
viniciusdaniel / cpf_validator.php
Last active May 6, 2021 23:23 — forked from guisehn/gist:3276015
Validar CPF (PHP)
<?php
function validar_cpf($cpf)
{
// Limpa caracteres e mantem apenas dígitos
$cpf = preg_replace('/[^0-9]/', '', (string) $cpf);
// Valida tamanho
if (strlen($cpf) != 11)
return false;
@viniciusdaniel
viniciusdaniel / cnpj_validator.php
Last active May 6, 2021 23:26 — forked from guisehn/gist:3276302
Validar CNPJ (PHP)
<?php
function validar_cnpj($cnpj)
{
// Limpa caracteres e mantem apenas dígitos
$cnpj = preg_replace('/[^0-9]/', '', (string) $cnpj);
// Valida tamanho
if (strlen($cnpj) != 14)
return false;
@viniciusdaniel
viniciusdaniel / google-hacking-techniques.md
Last active November 27, 2023 19:46
COPY - Exploring Google Hacking Techniques
@viniciusdaniel
viniciusdaniel / GoogleHackMasterList.txt
Created December 4, 2019 15:58 — forked from xiaoxiaoleo/GoogleHackMasterList.txt
The definitive super list for "Google Hacking".
admin account info" filetype:log
!Host=*.* intext:enc_UserPassword=* ext:pcf
"# -FrontPage-" ext:pwd inurl:(service | authors | administrators | users) "# -FrontPage-" inurl:service.pwd
"AutoCreate=TRUE password=*"
"http://*:*@www&#8221; domainname
"index of/" "ws_ftp.ini" "parent directory"
"liveice configuration file" ext:cfg -site:sourceforge.net
"parent directory" +proftpdpasswd
Duclassified" -site:duware.com "DUware All Rights reserved"
duclassmate" -site:duware.com
@viniciusdaniel
viniciusdaniel / bcm57765or57785fix
Created October 26, 2019 17:47 — forked from samgooi4189/bcm57765or57785fix
Fixing Broadcom Corporation BCM57765/57785 SDXC/MMC Card Reader
Follow the WORKAROUND:
1. Add a comand to /etc/rc.local, add the following line above "exit 0":
setpci -s 00:1c.2 0x50.B=0x41
2. Add the same comand to /etc/apm/resume.d/21aspm (which does not exist yet):
setpci -s 00:1c.2 0x50.B=0x41
3. Add the following to /etc/modprobe.d/sdhci.conf:
options sdhci debug_quirks2=4
4. Re-generate initrd:
sudo update-initramfs -u -k all
5. Reboot or reload sdhci module:
@viniciusdaniel
viniciusdaniel / proxy_start.sh
Created April 12, 2019 17:00
proxy http over proxy socks
#!/bin/bash
logFlogPath=/tmp/polipo.log;
cachePath=/tmp/polipo_cache;
socksPort=8123;
httpPort=8124;
proxyHost=127.0.0.1;
gatewayServer=10.0.0.1;
# Catch ctrl + c and close all stuff

Bash tips: Colors and formatting (ANSI/VT100 Control sequences)

The ANSI/VT100 terminals and terminal emulators are not just able to display black and white text ; they can display colors and formatted texts thanks to escape sequences. Those sequences are composed of the Escape character (often represented by “^[” or “<Esc>”) followed by some other characters: “<Esc>[FormatCodem”.

In Bash, the <Esc> character can be obtained with the following syntaxes:

  • `\e`
@viniciusdaniel
viniciusdaniel / webserver.pl
Created November 8, 2018 17:37
Small webserver just responding HTTP 200
#!/usr/bin/perl
use strict;
use IO::Socket;
my $server = IO::Socket::INET->new(
LocalPort => 80,
Type => SOCK_STREAM,
Reuse => 1,
Listen => 20