Skip to content

Instantly share code, notes, and snippets.


Bertrand Caron bertrand-caron

View GitHub Profile
bertrand-caron /
Created Jun 6, 2020
Script for reformatting exports into Excel friendly formats (requires first converting from Excel to CSV).
import pandas as pd
import numpy as np
from datetime import datetime
from argparse import ArgumentParser, Namespace
"Joined Group on",
"Last visited group on",
"Last Attended",
bertrand-caron /
Created May 14, 2020
List user roles and permissions for a AWS account
module purge
for credential in aws-dev aws-uat; do
echo "Credentials: ${credential}"
module load ${credential}
aws iam list-users
aws iam list-roles
module unload ${credential}
echo ""
bertrand-caron /
Last active May 1, 2020
List AWS buckets and their sizes
# Requires `awscli` (installed with pip) and a modern python version (>=3.6)
from datetime import datetime, timedelta
from subprocess import check_output
from json import loads, dumps
from typing import Tuple, NamedTuple
from multiprocessing import Pool
def sizeof_fmt(num: float, suffix: str = 'B') -> str:
from requests import get
from json import loads
bertrand-caron /
Last active Jun 6, 2018 — forked from syedrakib/
An example of asymmetric encryption in python using a public/private keypair - utilizes RSA from PyCrypto library and Python3.5
# Inspired from
# PyCrypto docs available at
from Crypto import Random
from Crypto.PublicKey import RSA
import base64
def generate_keys():
# RSA modulus length must be a multiple of 256 and >= 1024
modulus_length = 256 * 4 * 4 # use larger value in production
View closure.hs
add :: Int -> Int -> Int
add x y = x + y
fs :: [(Int -> Int)]
fs = map (\n -> add n) [1..3]
main = do
print $ map (\f -> f 0) fs