Skip to content

Instantly share code, notes, and snippets.

Avatar
🐈

Fil Zembowicz fzembow

🐈
View GitHub Profile
@fzembow
fzembow / get_max_csv_field_lengths.py
Created Aug 4, 2020
Prints the largest field lengths encountered in a CSV
View get_max_csv_field_lengths.py
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 Oct 12, 2019
Script to convert pngts to jpegs
View convert-pngs-to-jpeg.js
const glob = require('glob');
const sharp = require('sharp');
glob('./*.png', {}, async (e, filenames) => {
filenames.forEach(filename => {
sharp(filename)
.toFile(`${filename.replace(/\.png$/, '')}.jpeg`);
});
});
View app.py
# 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 Feb 22, 2019
Script to add md5 hash to filename
View add_md5_digest_to_filename.py
"""
Given filenames, MD5 hashes them and puts the hash in the filename
"""
import glob
import hashlib
import os
import random
import sys