Skip to content

Instantly share code, notes, and snippets.

Avatar

Pietro pgrandinetti

View GitHub Profile
View azPyDeploy.py
# This script needs
# $ pip install fabric
from os import environ
from fabric import Connection
# Create a file `secret.py` in the same directory as this one
# and add in it the credentials to connect to the server and GitHub.
# Here is a template.
View lean_monitoring.py
import time
import logging
import io
import atexit
import sys
import requests
stringio_stream = io.StringIO()
@pgrandinetti
pgrandinetti / .vimrc
Created Oct 10, 2020
Configuration file for VIM
View .vimrc
set nocompatible " required
set backspace=indent,eol,start
set encoding=utf-8
set nu
set tabstop=4
set expandtab
filetype off " required
filetype plugin indent on
let python_highlight_all=1
@pgrandinetti
pgrandinetti / encrypt_decrypt.py
Last active Oct 8, 2020
Python functions to generate asymmetric keys and encrypt/decrypt data
View encrypt_decrypt.py
# pip install pycrypto
import base64
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA
PUBLIC_KEY = '/home/public_key.pem'
PRIVATE_KEY = '/home/private_key.pem'
@pgrandinetti
pgrandinetti / automatic_websocket_reconnect.py
Last active May 3, 2021
Automatic reconnect from websockets
View automatic_websocket_reconnect.py
import socket
import asyncio
import websockets
import time
import logging
import argparse
import threading
import sys