Skip to content

Instantly share code, notes, and snippets.

View lsevero's full-sized avatar

Lucas Severo lsevero

  • São Paulo, Brazil
View GitHub Profile
@lsevero
lsevero / README.md
Created March 5, 2020 04:04 — forked from gdamjan/README.md
Setup for an easy to use, simple reverse http tunnels with nginx and ssh. It's that simple there's no authentication at all. The end result, a single ssh command invocation gives you a public url for your web app hosted on your laptop.

What

A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.

Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).

Requirements

@lsevero
lsevero / gerar_cnpj_cpf.lua
Created February 8, 2020 14:20 — forked from wandersoncferreira/gerar_cnpj_cpf.lua
Código para gerar CPF e CNPJ válidos em Lua
function digito_verificador(random_cnpj, pesos)
local table_check = {}
for i, p in ipairs(pesos) do
table_check[i] = random_cnpj[i] * p
end
local sum_check = 0
for i, p in ipairs(table_check) do
sum_check = sum_check + p
end
@lsevero
lsevero / postgresqlhandler.py
Created November 14, 2019 18:30 — forked from danielrichman/postgresqlhandler.py
python postgres log handler
import logging
import traceback
import psycopg2
class PostgreSQLHandler(logging.Handler):
"""
A :class:`logging.Handler` that logs to the `log` PostgreSQL table
Does not use :class:`PostgreSQL`, keeping its own connection, in autocommit
mode.
@lsevero
lsevero / curl-websocket.sh
Created October 2, 2019 16:32 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@lsevero
lsevero / Makefile
Created November 22, 2018 13:21 — forked from gvillalta99/Makefile
TDD on VHDL
#Project file
PRJ=counter_tb.prj
#Compiled executable
EXE=counter_tb.exe
#TCL commands that will run in the simulator
CMD=isim.cmd
#Temporary Command file
CMDTMP=isim.tmp.cmd
#Waveform DataBase from simulation
WDB=isim.wdb
@lsevero
lsevero / Facebook.elm
Created November 2, 2018 22:10 — forked from groteck/ Facebook.elm
elm facebook integration test
port module Facebook exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import String
import Debug
main =
import Html exposing (..)
import Html.App exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Html.Attributes exposing (..)
import Http
import Task exposing (Task)
import Json.Decode as Json exposing ((:=))
type Msg
@lsevero
lsevero / Chromecast batch conversion script
Created July 11, 2018 00:44 — forked from steventrux/Chromecast batch conversion script
A bash script to batch convert video files for chromecast compatibility
#! /bin/bash
# Batch Convert Script by StevenTrux
# The Purpose of this Script is to batch convert any video file to mp4 or mkv format for chromecast compatibility
# this script only convert necessary tracks if the video is already
# in H.264 format it won't convert it saving your time!
# Put all video files need to be converted in a folder!
# the name of files must not have " " Space!
# Rename the File if contain space
@lsevero
lsevero / command.py
Created February 5, 2018 18:28 — forked from elleryq/command.py
Wrap shell command as python function
# -*- encoding: utf-8 -*-
import subprocess
class command(object):
def __init__(self, cmd):
self._cmd = cmd
def __call__(self, *args, **kwargs):
cmd = [self._cmd]