Skip to content

Instantly share code, notes, and snippets.

View luthfianto's full-sized avatar

Rizky Luthfianto luthfianto

View GitHub Profile
const sqlite3 = require("sqlite3")
class SqliteDF {
table: any;
created: boolean;
con: any;
max_index: number;
_group_cols: any;
verbose: boolean;
_cache: any;
console.error(e);
let { message } = e;
if (e.sqlMessage) {
message = e.sqlMessage.split(" for")[0];
}
throw new Error(message);
async function mergeSort<T>(arr: T[]): Promise<T[]> {
if (arr.length < 2) {
return arr;
}
const middle = Math.floor(arr.length / 2);
const left = arr.slice(0, middle);
const right = arr.slice(middle);
const leftPromise = mergeSort(left);
/*
* The MIT License
*
* Copyright (c) 2010 Mike de Boer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
SHELL=/bin/bash
VW=vw
python_exe=python2.7
train_data=wsj_train_subset
test_data=wsj_test_subset
tag=tags
.SECONDARY:
{
"defaultSeverity": "error",
"extends": [
"tslint:all"
],
"jsRules": {},
"rules": {
"array-type": false,
"comment-format": false,
"forin": false,
class FullScoreReturn {
constructor(
public readonly log_prob: number,
public readonly ngram_length: number,
public readonly oov: number,
) { }
get prob() {
return this.log_prob;
}
@luthfianto
luthfianto / TFQueueKeras.py
Created March 29, 2017 17:11 — forked from Dref360/TFQueueKeras.py
An example of using keras with tf queues, this handle BatchNorm
import tensorflow as tf
import numpy as np
import keras
import keras.backend as K
from functools import reduce
from keras.models import Model
import keras.callbacks as cbks
from keras.applications import ResNet50
from keras.layers import Conv2D
import threading
@luthfianto
luthfianto / Attention.py
Last active July 15, 2020 09:27 — forked from cbaziotis/Attention.py
Keras Layer that implements an Attention mechanism for temporal data. Supports Masking. Follows the work of Raffel et al. [https://arxiv.org/abs/1512.08756]
from keras.layers.core import Layer
from keras import initializers, regularizers, constraints
from keras import backend as K
class Attention(Layer):
def __init__(self,
kernel_regularizer=None, bias_regularizer=None,
kernel_constraint=None, bias_constraint=None,
use_bias=True, **kwargs):
"""