Notes on the unique stuff about go, in the context of other languages that I already know.
- Root dir
go
src
andbin
inside the project- unique project/package name
The first statement in a go source file must be
package packagenamehere
const jsdom = require('jsdom') | |
const { | |
JSDOM | |
} = jsdom | |
function toJSDOM(responseBody) { | |
return new JSDOM(responseBody) | |
} | |
/** |
A list of the gists that have proved most useful to new JS devs on GitHub.
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.
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.
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()); |