Skip to content

Instantly share code, notes, and snippets.

👨‍💻
programming

Zach Caceres zcaceres

👨‍💻
programming
View GitHub Profile
@zcaceres
zcaceres / instagram-html-parser.js
Created Jan 21, 2020
A simple parser for pulling structured data from the HTML of an Instagram profile.
View instagram-html-parser.js
const jsdom = require('jsdom')
const {
JSDOM
} = jsdom
function toJSDOM(responseBody) {
return new JSDOM(responseBody)
}
/**
@zcaceres
zcaceres / go-weird-parts.md
Created Dec 15, 2019
Go: The Weird Parts – Relating Go to other Languages I Already Know
View go-weird-parts.md

Go: The Weird Parts

Notes on the unique stuff about go, in the context of other languages that I already know.

Project Organization

  1. Root dir go
  2. src and bin inside the project
  3. unique project/package name

The first statement in a go source file must be package packagenamehere

@zcaceres
zcaceres / basic-js-greatest-hits.md
Last active Mar 17, 2020
Articles Written to Help New JS Devs
@zcaceres
zcaceres / Audio Data Augmentation.ipynb
Last active Mar 27, 2019
Some data augmentation for audio
View Audio Data Augmentation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zcaceres
zcaceres / wav2letter-asg.md
Last active May 27, 2020
Rough Draft Faster, Better Speech Recognition with Wav2Letter's Auto Segmentation Criterion
View wav2letter-asg.md

Faster, Better Speech Recognition with Wav2Letter's Auto Segmentation Criterion

In 2016, Facebook AI Research (FAIR) broke new ground with Wav2Letter, a fully convolutional speech recognition system.

In Wav2Letter, FAIR showed that systems based on convolutional neural networks (CNNs) could person as well as traditional recurrent neural network-based approaches.

In this article, we'll focus on an understudied module at the core of Wav2Letter: the Auto Segmentation (ASG) Criterion.

Architecture of the wav2letter model

@zcaceres
zcaceres / supercharge-your-bash-workflows-with-gnu-parallel.md
Last active Feb 4, 2020
Supercharge Your Bash Workflows with GNU `parallel`
View supercharge-your-bash-workflows-with-gnu-parallel.md

Supercharge Your Bash Workflows with GNU parallel

GNU parallel is a command line tool for running jobs in parallel.

parallel is awesome and belongs in the toolbox of every programmer. But I found the docs a bit overwhelming at first. Fortunately, you can start being useful with parallel with just a few basic commands.

Why is parallel so useful?

Let's compare sequential and parallel execution of the same compute-intensive task.

Imagine you have a folder of .wav audio files to convert to .flac:

View node-python-fastai-4.py
from model_fastai import FastaiImageClassifier
class PythonServer(object):
def listen(self):
print(f'Python Server started listening on {PORT} ...')
def predict_from_img(self, img_path):
model = FastaiImageClassifier()
return model.predict(img_path)
View node-python-fastai-3.js
static async invoke(method, ...args) {
try {
const zerorpc = PythonConnector.server();
return await Utils.promisify(zerorpc.invoke, zerorpc, method, ...args);
}
catch (e) {
return Promise.reject(e)
}
}
View node-python-fastai-2.js
...
// Our prediction endpoint (Receives an image as req.file)
app.post('/predict', upload.single('img'), async function (req, res) {
const { path } = req.file
try {
const prediction = await PythonConnector.invoke('predict_from_img', path);
res.json(prediction);
}
catch (e) {
View node-python-fastai-1.js
class PythonConnector {
static server() {
if (!PythonConnector.connected) {
console.log('PythonConnector – making a new connection to the python layer');
PythonConnector.zerorpcProcess = spawn('python3', ['-u', path.join(__dirname, 'PythonServer.py')]);
PythonConnector.zerorpcProcess.stdout.on('data', function(data) {
console.info('python:', data.toString());
});
PythonConnector.zerorpcProcess.stderr.on('data', function(data) {
console.error('python:', data.toString());
You can’t perform that action at this time.