Skip to content

Instantly share code, notes, and snippets.

View joe-antognini's full-sized avatar

Joseph Antognini joe-antognini

View GitHub Profile
@joe-antognini
joe-antognini / sox_tricks.md
Last active July 3, 2018 20:06
Sox tricks

Clip / trim an audio file

sox input output trim <start> <duration>

Resample audio and convert to mono

sox input -c 1 -r 16000 output
@joe-antognini
joe-antognini / tensorflow_tricks.md
Last active July 6, 2018 18:47
Useful Tensorflow commands

Get Tensors in graph

[n.name for n in tf.get_default_graph().as_graph_def().node]

Get a Tensor by name

tf.get_default_graph().get_tensor_by_name(name)
@joe-antognini
joe-antognini / convert_to_tfrecords.py
Last active June 27, 2018 05:36
A quick and dirty script to convert MNIST files to TFRecords
"""An example of how to convert to TFRecords."""
import os
import numpy as np
import tensorflow as tf
dirpath = '/home/joe/data/mnist'
raw_train_data = np.fromfile(os.path.join(dirpath, 'train-images-idx3-ubyte'), dtype=np.uint8)
raw_train_labels = np.fromfile(os.path.join(dirpath, 'train-labels-idx1-ubyte'), dtype=np.uint8)
Text #000000
Background #d0d7dc
Color 1 #2e3436
Color 2 #ff0000
Color 3 #00aa00
Color 4 #ab5500
Color 5 #0000aa
Color 6 #aa00aa
Color 7 #00aaaa
Color 8 #aaaaaa
#! /usr/bin/env python
#
# random_fingerprint
#
# Generate a random hexadecimal number
#
import random
#! /bin/bash
#
# qpriority
#
# Returns the priority of the job ID submitted to the PBS server.
#
# Usage statement
if [[ $# -ne 1 ]]
#! /usr/bin/env python
#
# qjog
#
# Remove and resubmit all currently running jobs from the PBS server. This
# is a kind of poor-man's preemption as it will allow high priority jobs in
# the queue to start running instead of currently running low-priority jobs.
#
@joe-antognini
joe-antognini / rolling_window.py
Created October 4, 2016 19:06
Multidimensional numpy rolling window
#! /usr/bin/env python
import numpy as np
def rolling_window(a, window, axis=-1):
'''Return a windowed array.
Parameters:
a: A numpy array
window: The size of the window

Keybase proof

I hereby claim:

  • I am joe-antognini on github.
  • I am antognini (https://keybase.io/antognini) on keybase.
  • I have a public key whose fingerprint is F00B 9D2E B2DF 8B44 508E D12F B6E6 587C 509D 0C50

To claim this, I am signing this object:

@joe-antognini
joe-antognini / fulltex
Created April 28, 2014 17:54
Run LaTeX and BibTeX several times on a document to get all the references in place
#! /bin/bash
#
# fulltex
#
# Script to run LaTeX and BibTeX multiple times. Requires an argument
# with the name of the file to run LaTeX on (without the .tex extension)
#
# Joe Antognini
# Fri Nov 30 13:39:07 EST 2012