Skip to content

Instantly share code, notes, and snippets.

View c-neto's full-sized avatar
🚀

Carlos Neto c-neto

🚀
View GitHub Profile
@hrszanini
hrszanini / continuous_thread___init__.py
Created February 11, 2021 06:11
ContinuousReference
from .structure import (
ContinuousReference
)
__all__ = ["ContinuousReference"]
import hmac
import hashlib
import base64
import json
import datetime
secret_key = '52d3f853c19f8b63c0918c126422aa2d99b1aef33ec63d41dea4fadf19406e54'
def create_jwt(payload):
payload = json.dumps(payload).encode()
@marshalhayes
marshalhayes / README.md
Last active July 3, 2024 12:33
TLS encryption of Python sockets using the "SSL" module

README.md

Follow these steps before trying to run any code.

  1. First, generate a Certificate Authority (CA).

openssl genrsa -out rootCA.key 2048

  1. Second, self-sign it.
@CarlosDomingues
CarlosDomingues / python-poetry-cheatsheet.md
Last active July 12, 2024 17:05
Python Poetry Cheatsheet

Create a new project

poetry new <project-name>

Add a new lib

poetry add <library>

Remove a lib

@GLMeece
GLMeece / Sphinx_Setup_for_autodoc.md
Last active November 29, 2023 14:22
Setting up Sphinx for generating documentation from DocStrings, leveraging the Napoleon extension.

Sphinx Setup for autodoc

Sphinx is a documentation generator that is the de facto standard for Python projects. The official documentation can be a bit daunting as it includes so many options, it's hard to know where to start.

Note: This Gist was updated on 04/04/2019 to accomodate a newer version of Sphinx, as well as Python 3.7. YMMV!

This document is written with the following presuppositions:

@WestleyK
WestleyK / output-color.sh
Created August 15, 2018 01:19
printf color output
#!/bin/bash
#
# Created by: Westley K
# Date: Aug 14, 2018
#
# run this in your terminal, and
# you will get nice colors and effects!
#
@pharzan
pharzan / server.py
Last active March 6, 2024 10:03
esp8266 post json data using usocket
#listens to the above run to
#FLASK_APP=server.py FLASK_DEBUG=1 python3.5 -m flask run -h 192.168.1.124 -p 8999:
#run this on the local server to listen to socket communication
from flask import Flask, render_template, jsonify
from flask import request as query
app = Flask(__name__)
@mariocesar
mariocesar / index.html
Last active April 16, 2023 02:49
Example Python + Websockets to emulate tail -f
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Tail </title>
<style>
body {font-family: monospace;}
p{ margin: 0;}
ul{padding: 0;}
@szurcher
szurcher / centos7.json
Last active September 12, 2021 09:56
CentOS 7 Minimal kickstart file and Packer config.json for building a vagrant virtualbox base box with guest additions installed. Based off of https://www.centosblog.com/centos-7-minimal-kickstart-file/
{
"builders": [{
"type": "virtualbox-iso",
"guest_os_type": "RedHat_64",
"iso_url": "[YOUR ISO PATH HERE]",
"iso_checksum": "[YOUR ISO CHECKSUM HERE]",
"iso_checksum_type": "sha256",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "1500s",
@fsodogandji
fsodogandji / socat-tips.sh
Last active July 27, 2024 20:43
socat tips & tricks
#To create a classic TCP listening daemon, similar to netcat -l, use a variation of the following command.
socat TCP-LISTEN:8080 stdout
#use remotly a command shell
socat TCP4-LISTEN:1234,reuseaddr,fork 'SYSTEM:/bin/cat /home/infos.txt'
#sslify a server
socat OPENSSL-LISTEN:443,reuse‐addr,pf=ip4,fork,cert=server.pem,cafile=client.crt TCP4-CONNECT:localhost:80