Skip to content

Instantly share code, notes, and snippets.

View mauro-balades's full-sized avatar
😪
Focusing

mauro 🤙 mauro-balades

😪
Focusing
View GitHub Profile
@mauro-balades
mauro-balades / re_replace.h
Created November 28, 2021 16:47 — forked from tanbro/re_replace.h
str replace and regex replace functions in C language
#ifndef __RE_REPLACE__
#define __RE_REPLACE__
#include <string.h>
#include <regex.h>
#ifdef __cplusplus
extern "C" {
#endif
@mauro-balades
mauro-balades / ssl_redirect.py
Created November 28, 2021 17:11 — forked from devries/ssl_redirect.py
WSGI middleware to redirect incoming http requests to https. This is not original, but I can't remember where I first found it.
from urllib import quote
class SSLRedirect(object):
def __init__(self,app):
self.app=app
def __call__(self,environ,start_response):
proto = environ.get('HTTP_X_FORWARDED_PROTO') or environ.get('wsgi.url_scheme', 'http')
if proto=='https':
@mauro-balades
mauro-balades / infinite.py
Created November 28, 2021 17:11 — forked from categulario/infinite.py
bucle for infinito en python
def inf(i=0, step=1):
#un generador de iteradores infinitos, como el xrange, pero infinito
while True:
yield i
i+=step
for i in inf():
print i
@mauro-balades
mauro-balades / regExMatches.c
Created November 29, 2021 15:57 — forked from raoulduke/regExMatches.c
C regex get all matches
#include <stdio.h>
#include <string.h>
#include <regex.h>
#define TEST_REGEX "^.*\\/([a-zA-Z_.]*)\\.log : [A-Z]{3} [0-9]{2}\\/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{6} .* : (.*)$"
#define MAX_REGEX_MATCHES 5
#define MAX_STRING_SIZE 1000
#define MAX_ERR_LENGTH 50
/**
@mauro-balades
mauro-balades / install-odoo.sh
Created December 1, 2021 16:14 — forked from yelizariev/install-odoo.sh
install odoo from source. Script is maintained on github now: https://github.com/yelizariev/install-odoo
if [ "$(basename $0)" = "install-odoo.sh" ]; then
echo "don't run install-odoo.sh, because it's not fully automated script. Copy, paste and execute commands from this file manually"
exit 0
fi
#### Detect type of system manager
export SYSTEM=''
pidof systemd && export SYSTEM='systemd'
@mauro-balades
mauro-balades / socket_portable.c
Created December 6, 2021 13:01 — forked from FedericoPonzi/socket_portable.c
C sockets portable in windows/linux example
// As seen on http://www.di.uniba.it/~reti/LabProRete/Interazione(TCP)Client-Server_Portabile.pdf
#if defined WIN32
#include <winsock.h>
#else
#define closesocket close
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include <stdio.h>
@mauro-balades
mauro-balades / ohmyzsh.md
Created December 10, 2021 15:48 — forked from yovko/ohmyzsh.md
ZSH (using Oh My ZSH) on Manjaro Linux

ZSH (using Oh My ZSH) on Manjaro Linux

0. If ZSH is not already installed on your Manjaro system you can do it with the command:

sudo pacman -Syu zsh

You do not need to install manjaro-zsh-config and all the other related packages like zsh-syntax-highlighting, zsh-history-substring-search, zsh-autosuggestions, etc., as we will use Oh My Zsh.

@mauro-balades
mauro-balades / dump_cert.sh
Created December 24, 2021 08:22 — forked from chrisdlangton/dump_cert.sh
Script to dump the entire cert.sh database as CSV
#!/usr/bin/env bash
SCHEMA=public
DB=certwatch
HOST=crt.sh
PORT=5432
USER='guest --no-password'
DIR=$(pwd)
mkdir -p $DIR
@mauro-balades
mauro-balades / waybacksploit.sh
Created December 24, 2021 08:22 — forked from chrisdlangton/waybacksploit.sh
The real dark web - find and exploit forgotten files on servers
#!/usr/bin/env bash
if [ -z $(which retire) ]; then
echo "retire not found. try npm install -g retire"
exit 1
fi
if [ -z $(which parallel) ]; then
echo "parallel not found. try 'apt install -y parallel'"
exit 1
fi
@mauro-balades
mauro-balades / README.md
Last active January 13, 2022 20:25
Regex

Learn Regex

Programmers seem to struggle with regex. In this post, I will show you how easy regex can be and some usefull examples for regex.