Skip to content

Instantly share code, notes, and snippets.

View zcaceres's full-sized avatar
👨‍💻
programming

Zach Caceres zcaceres

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

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 March 23, 2024 22:44
Articles Written to Help New JS Devs
@zcaceres
zcaceres / Audio Data Augmentation.ipynb
Last active December 25, 2020 09:17
Some data augmentation for audio
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 April 28, 2022 23:57
Rough Draft Faster, Better Speech Recognition with Wav2Letter's Auto Segmentation Criterion

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 October 19, 2021 12:05
Supercharge Your Bash Workflows with GNU `parallel`

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:

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)
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)
}
}
...
// 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) {
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());