Skip to content

Instantly share code, notes, and snippets.

View hervenivon's full-sized avatar
🎨
Teaching art to computers

Hervé Nivon hervenivon

🎨
Teaching art to computers
View GitHub Profile
@hervenivon
hervenivon / contacts-extractor.py
Created June 25, 2021 12:35
Outlook Mac `olm` archive contact extractor
#!/usr/bin/env python
import re
import sys
import xml.etree.ElementTree as ET
from collections import Counter
from zipfile import ZipFile
messageRe = re.compile('.*message_[0-9]{5}\.xml')
@hervenivon
hervenivon / extend-apfs-container
Created January 29, 2021 11:28
A script to expand the APFS container on the boot volume with AWS EC2 Mac Instance
#!/bin/bash
PDISK=$(diskutil list physical external | head -n1 | cut -d' ' -f1)
APFSCONT=$(diskutil list physical external | grep Apple_APFS | tr -s ' ' | cut -d' ' -f8)
sudo diskutil repairDisk $PDISK
sudo diskutil apfs resizeContainer $APFSCONT 0
# https://derflounder.wordpress.com/2020/12/19/resizing-an-aws-macos-ec2-instances-boot-drive-to-use-all-available-disk-space/
@hervenivon
hervenivon / boto3_multipartupload.py
Created November 18, 2020 21:31
Upload large files in multi part
import boto3
import os
import sys
import threading
from boto3.s3.transfer import TransferConfig
s3_client = boto3.client('s3')
# S3 transfer documentation: https://boto3.amazonaws.com/v1/documentation/api/1.9.156/reference/customizations/s3.html?highlight=transferconfig#boto3.s3.transfer.TransferConfig
@hervenivon
hervenivon / keybase.md
Created September 20, 2019 07:26
Keybase.io identity proof

Keybase proof

I hereby claim:

  • I am hervenivon on github.
  • I am hervenivon (https://keybase.io/hervenivon) on keybase.
  • I have a public key ASBJ_f63WUy1KE_v3t4gl9-HrPHan7a7ermnnexboSIC-go

To claim this, I am signing this object:

@hervenivon
hervenivon / parallel.py
Created March 13, 2019 09:12
Scaffolding for parallel python and `tqdm`
#!/usr/bin/env python3
from multiprocessing import Pool
from tqdm import tqdm
from queue import Queue
from threading import Thread
import random
import time
THREADS = 5
@hervenivon
hervenivon / .bash_profile
Last active February 15, 2018 00:31
.bash_profile for Amazon Linux DLAMI based (including gdal)
# default .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=/usr/local/bin/:$HOME/.local/bin:$HOME/bin:$PATH
@hervenivon
hervenivon / benchmark.js
Created January 15, 2018 15:26
Quick performance read/write comparison based on linux `dd`
#!/bin/bash
BUFFERSIZE=1048576
WHERE="/dev/shm/test /mnt/data/test"
RESULTS="/tmp/benchmark_results.csv"
echo "WHERE;TYPE;SIZE;DURATION;SPEED;SPEEDUNIT" > $RESULTS
for i in `seq 1 10`;
do
@hervenivon
hervenivon / awazon-linux-gdal-installation.sh
Last active April 15, 2022 11:48
Install GEOS, PROJ4 & GDAL on amazon linux
export PYTHON_VERSION=3.4.3
export PYTHON_SHORT_VERSION=3.4
export GEOS_VERSION=3.6.2
export GDAL_VERSION=2.2.2
export PROJ4_VERSION=4.9.3
sudo yum-config-manager --enable epel
sudo yum install gdal-python
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel
@hervenivon
hervenivon / config.yml
Last active June 23, 2021 04:22
circleci config file for node8 and dynamodb on localstack
version: 2
references:
base_container_config: &base_container_config
docker:
- image: circleci/node:8
working_directory: ~/repo
test_container_config: &test_container_config
docker:
@hervenivon
hervenivon / ThisOutlookSession.vba
Last active October 13, 2015 08:37
Outlook VBA for email addresses extraction. To place in 'ThisOutlookSession'
'this procedure is largely inspired by a comment from Bujez on Novembre 2010 on this thread:
'http://omaralzabir.com/get_email_address_of_all_users_from_all_mails_in_outlook_folder/
'Rewright needs to be done to make it recursive but it works as is with Outlook 2013
Sub EmailExport()
'Requires reference to Microsoft Scripting Runtime
'Tools –> References –> check “Microsoft Scripting Runtime”
Dim outApp As New Outlook.Application
Dim mpf As Outlook.MAPIFolder
Dim mpfSubFolder As Outlook.MAPIFolder
Dim flds As Outlook.Folders