Skip to content

Instantly share code, notes, and snippets.

View fzembow's full-sized avatar
🐈

Fil Zembowicz fzembow

🐈
View GitHub Profile
@fzembow
fzembow / get_max_csv_field_lengths.py
Created August 4, 2020 20:43
Prints the largest field lengths encountered in a CSV
import csv
import sys
from collections import defaultdict
def print_max_field_lengths(fname):
"""
Prints the largest field lengths encountered in the csv
file in fname
"""
@fzembow
fzembow / convert-pngs-to-jpeg.js
Created October 12, 2019 17:14
Script to convert pngts to jpegs
const glob = require('glob');
const sharp = require('sharp');
glob('./*.png', {}, async (e, filenames) => {
filenames.forEach(filename => {
sharp(filename)
.toFile(`${filename.replace(/\.png$/, '')}.jpeg`);
});
});
# Signed URL generation demo
# Author: Fil Zembowicz <fil@formsort.com>
usage = "AWS_REGION=... AWS_BUCKET=... AWS_UPLOAD_FOLDER=... flask run"
import boto3
import os
import uuid
from flask import Flask, request, abort, jsonify
@fzembow
fzembow / add_md5_digest_to_filename.py
Created February 22, 2019 17:22
Script to add md5 hash to filename
"""
Given filenames, MD5 hashes them and puts the hash in the filename
"""
import glob
import hashlib
import os
import random
import sys