Skip to content

Instantly share code, notes, and snippets.


Pietro pgrandinetti

View GitHub Profile
# This script needs
# $ pip install fabric
from os import environ
from fabric import Connection
# Create a file `` in the same directory as this one
# and add in it the credentials to connect to the server and GitHub.
# Here is a template.
import time
import logging
import io
import atexit
import sys
import requests
stringio_stream = io.StringIO()
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 /
Last active Oct 8, 2020
Python functions to generate asymmetric keys and encrypt/decrypt data
# 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 /
Last active May 3, 2021
Automatic reconnect from websockets
import socket
import asyncio
import websockets
import time
import logging
import argparse
import threading
import sys