Skip to content

Instantly share code, notes, and snippets.

eerwitt / example_output.txt
Created Feb 1, 2016
TensorFlow resize_image_with_crop_or_pad with an input pipeline to avoid issues with the image's shape not being fully defined. The example image is a 2x2 pixel color image used for testing.
View example_output.txt
Original Image:
[[[255 255 40]
[125 255 67]]
[[ 55 121 231]
[255 40 151]]]
Padded Image:
[[[255 255 40]

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault


eerwitt /
Last active Jul 18, 2022
Parsing a WAV file using basic Python
import struct
def parse_wave_raw(filename):
# Open the example wave file stored in the current directory.
with open(filename, 'rb') as wav_file:
# Main Header
chunk_id =
assert chunk_id == b'RIFF', 'RIFF little endian, RIFX big endian: assume RIFF'
eerwitt /
Created Jan 31, 2016
Example loading multiple JPEG files with TensorFlow and make them available as Tensors with the shape [[R, G, B], ... ].
# Typical setup to include TensorFlow.
import tensorflow as tf
# Make a queue of file names including all the JPEG images files in the relative
# image directory.
filename_queue = tf.train.string_input_producer(
# Read an entire image file which is required since they're JPEGs, if the images
# are too large they could be split in advance to smaller files or use the Fixed