Skip to content

Instantly share code, notes, and snippets.

View leleobhz's full-sized avatar
🇧🇷

Leonardo Amaral leleobhz

🇧🇷
View GitHub Profile
@gsilos
gsilos / openssl-messenger.md
Last active September 10, 2023 19:28
secure communication

Why?

Since it is not possible to rely on the encryption that is provided for us in our daily applications (email, chat, etc), so, I decide to create this method as an alternative to quickly send sensitive data through current chat applications, email, etc.

How?

Using openssl in both sides (the sender and the receiver) is possible to exchange encrypted messages using our preffered chat application. In this process, I tied receiver's github account with his SSH public key, that way we can believe a little bit more if the receiver is who we think he is.

Before starting

@ernestboey
ernestboey / Dockerfile
Last active July 3, 2023 20:21
Create Docker image with Alpine 3.9 + Golang 1.12.9 + Node.js 10.16.3
FROM node:10.16.3-alpine
# Golang From: https://github.com/docker-library/golang/blob/master/1.12/alpine3.10/Dockerfile
RUN apk add --no-cache \
ca-certificates
# set up nsswitch.conf for Go's "netgo" implementation
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
@georgexsh
georgexsh / goto.py
Created September 18, 2017 07:47
python goto with system trace function
import sys
def j(lineno):
frame = sys._getframe().f_back
called_from = frame
def hook(frame, event, arg):
if event == 'line' and frame == called_from:
try:
frame.f_lineno = lineno
@gsomoza
gsomoza / ztvpn.sh
Last active September 28, 2020 04:17
ZeroTier VPN Switch Script
#!/bin/bash
ZT_NETWORK="NETWORK_ID"
# colors
RCol='\033[0m' # Text Reset
LGra='\033[0;37m';
Red='\033[0;31m';
Gre='\033[0;32m';
Yel='\033[0;33m';
@SmartFinn
SmartFinn / dhcp-leases-to-dns.rsc
Last active April 30, 2024 12:57
MikroTik (RouterOS) script for automatically setting DNS records for clients when they obtain a DHCP lease
# MikroTik (RouterOS) script for automatically setting DNS records
# for clients when they obtain a DHCP lease.
#
# author SmartFinn <https://gist.github.com/SmartFinn>
:local dnsTTL "00:15:00";
:local token "$leaseServerName-$leaseActMAC";
# Normalize hostname (e.g. "-= My Phone =-" -> "My-Phone")
# - truncate length to 63 chars
@rubo77
rubo77 / ipv6-httpd.py
Created November 24, 2015 12:56 — forked from akorobov/ipv6-httpd.py
quick ipv6 http server using python's SimpleHttpServer
import socket
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
class MyHandler(SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/ip':
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
@jdoss
jdoss / ovs_libvirt.md
Created October 31, 2015 23:30
Configure Fedora Server with Open vSwitch and Libvirt

This will allow you to use Open vSwitch with Libvirt to put your VMs on the same network as the host and not use the default NAT based bridge.

Install Packages

dnf install -y virt-install libvirt openvswitch

Services Prep Work

Disable NetworkManager :(

@kiler129
kiler129 / cloudflare_update.script
Last active October 11, 2023 09:10
Automatic script for Mikrotik RouterOS updating record on CloudFlare.
#########################################################################
# ================================================== #
# $ Mikrotik RouterOS update script for CloudFlare $ #
# ================================================== #
# #
# - You need a CloudFlare account & api key (look under settings), #
# a zone and A record in it #
# - All variables in first section are obvious, except CFid, #
# To obtain CFid use following command in any unix shell: #
# curl https://www.cloudflare.com/api_json.html -d 'a=rec_load_all' -d 'tkn=YOUR_API_KEY' -d 'email=email@example.com' -d 'z=domain.com'|python -mjson.tool
@EdwardBetts
EdwardBetts / pprint_color.py
Last active March 19, 2024 18:17
Python pprint with color syntax highlighting for the console
from pprint import pformat
from typing import Any
from pygments import highlight
from pygments.formatters import Terminal256Formatter
from pygments.lexers import PythonLexer
def pprint_color(obj: Any) -> None:
"""Pretty-print in color."""
@lsowen
lsowen / update-dns.sh
Last active March 16, 2020 17:31
Calculate Reverse ipv6 PTR Record in Bash (using awk and sed)
function reverseIp6 {
echo "$1" | awk -F: 'BEGIN {OFS=""; }{addCount = 9 - NF; for(i=1; i<=NF;i++){if(length($i) == 0){ for(j=1;j<=addCount;j++){$i = ($i "0000");} } else { $i = substr(("0000" $i), length($i)+5-4);}}; print}' | rev | sed -e "s/./&./g"
}
$(reverseIp6 "2001:db8:85a3::8a2e:370:7334")"ip6.arpa."
#Result: 4.3.3.7.0.7.3.0.e.2.a.8.0.0.0.0.0.0.0.0.3.a.5.8.8.b.d.0.1.0.0.2.ip6.arpa.