Skip to content

Instantly share code, notes, and snippets.

View pgrandinetti's full-sized avatar

Pietro pgrandinetti

View GitHub Profile
# 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.
import time
import logging
import io
import atexit
import sys
import requests
stringio_stream = io.StringIO()
@pgrandinetti
pgrandinetti / .vimrc
Last active April 20, 2023 08:47
Configuration file for VIM
let mapleader=","
let $vundle="~/.vim/bundle/Vundle.vim"
" Be iMproved
set nocompatible
"=====================================================
"" Vundle settings
"=====================================================
@pgrandinetti
pgrandinetti / encrypt_decrypt.py
Last active October 8, 2020 13:28
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
pgrandinetti / automatic_websocket_reconnect.py
Last active January 22, 2024 21:55
Automatic reconnect from websockets
import socket
import asyncio
import websockets
import time
import logging
import argparse
import threading
import sys