Skip to content

Instantly share code, notes, and snippets.

View xrick's full-sized avatar

Jiue-Ren Liao (Rick) xrick

  • Taiwan, Taipei
View GitHub Profile
@xrick
xrick / reconnect.js
Created December 1, 2022 08:13 — forked from carlhoerberg/reconnect.js
How to build reconnect logic for amqplib
var amqp = require('amqplib/callback_api');
// if the connection is closed or fails to be established at all, we will reconnect
var amqpConn = null;
function start() {
amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) {
if (err) {
console.error("[AMQP]", err.message);
return setTimeout(start, 1000);
}
@xrick
xrick / dm.py
Created March 16, 2018 08:14 — forked from Zardoz89/dm.py
Delta Modulation Coding and Decoding
#!/usr/bin/env python3
import array
import audioop
import wave
import sys
import time
try:
"""
This is a batched LSTM forward and backward pass
"""
import numpy as np
import code
class LSTM:
@staticmethod
def init(input_size, hidden_size, fancy_forget_bias_init = 3):