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

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 / 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/
@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 / 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 / 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 / compile-pgmodeler.sh
Last active April 3, 2020 03:30
compile pgmodeler on ubuntu
wget https://github.com/pgmodeler/pgmodeler/archive/v0.9.2.zip #latest version at time of writing
unzip v0.9.2.zip -d pgmodeler
pushd pgmodeler
sudo apt-get install qtbase5-dev-tools qt5-default libqt5svg5-dev gcc libxml2-dev postgresql libpq-dev qttools5-dev
qmake pgmodeler.pro
make
sudo make install
popd
@lsevero
lsevero / core.clj
Created May 5, 2020 16:04 — forked from mikeball/core.clj
Postgres listen/notify in Clojure using http://impossibl.github.io/pgjdbc-ng/
; Postgres listen/notify in Clojure using http://impossibl.github.io/pgjdbc-ng/
; in project.clj dependencies
; [com.impossibl.pgjdbc-ng/pgjdbc-ng "0.5"]
(ns pglisten.core
(:import [com.impossibl.postgres.jdbc PGDataSource]
[com.impossibl.postgres.api.jdbc PGNotificationListener]))
@lsevero
lsevero / gist:c1cd2cd2e6f19757fefb2e5eecb15fca
Created August 2, 2020 00:18 — forked from sebfisch/gist:2235780
Laymans explanation of delimited continuations with examples of using them for exception handling and nondeterministic programming.

Delimited Continuations

Delimited continuations manipulate the control flow of programs. Similar to control structures like conditionals or loops they allow to deviate from a sequential flow of control.

We use exception handling as another example for control flow manipulation and later show how to implement it using delimited continuations. Finally, we show that nondeterminism can also be expressed using delimited continuations.

Exception Handling

@lsevero
lsevero / 000_how-to-construct-environment-for-common-lisp.md
Created August 2, 2020 16:04 — forked from otaon/000_how-to-construct-environment-for-common-lisp.md
vim と slimv と roswell と swank で common lisp を書く環境を作る

本記事の位置づけ

下記を実現するための手順書。

  • roswell(lisp実行環境構築ツール)を導入する
  • slimv(VimにおけるSLIME)を導入する
  • roswellとslimvでcommon lispをコーディング、実行するための設定をする

手順一覧

下記の順番に環境構築する。

@lsevero
lsevero / Pipfile
Created December 30, 2020 14:21 — forked from onecrayon/Pipfile
async/await FastAPI with SQLAlchemy test
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
pylint = "*"
[packages]
sqlalchemy = "*"