Skip to content

Instantly share code, notes, and snippets.

View kjagiello's full-sized avatar

Krzysztof Jagiełło kjagiello

View GitHub Profile
@keithshep
keithshep / csv_to_hdf5.py
Created November 5, 2014 17:33
convert CSV file to HDF5 using h5py
#!/usr/bin/env python -O
import argparse
import sys
import numpy
import h5py
import csv
class ColType:
UNKNOWN = 1
-- Run script that dumps DB data into csv over S3
-- Run EMR script to while will process the data - maybe executed as cron from our ec2?
-- Saves processed data in CSV over s3
-- Scripts runs and puts the data from CSV into PGSQL DB.
-- Remove old CSV, new CSV and close the EMR instance.
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 27, 2024 00:18
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@olooney
olooney / cropped_thumbnail.my
Created January 12, 2012 16:31
A "better" thumbnail algorithm for Python Image Library PIL Image
'''
PIL's Image.thumbnail() returns an image that fits inside of a given size (preserving aspect ratios)
but the size of the actual image will vary and is certainly not guaranteed to be the requested size.
This is often inconvenient since the size of the returned thumbnail cannot be predicted. The django-thumbs
library solves this for square thumbnails by cropping the image to a square and then resizing it. However,
this only works for exact squares.
This function generalizes that approach to work for thumbnails of any aspect ratio. The returned thumbnail
is always exactly the requested size, and edges (left/right or top/bottom) are cropped off to adjust to
make sure the thumbnail will be the right size without distorting the image.