Skip to content

Instantly share code, notes, and snippets.

View rnd-forests's full-sized avatar

Vinh Nguyen rnd-forests

View GitHub Profile
@rnd-forests
rnd-forests / script.js
Created August 8, 2023 02:25
K6 sample constant rate
import http from 'k6/http';
import { sleep, check } from 'k6';
function hitAPIWithRate(config) {
const {
baseUrl,
endpoint,
method, // Only support GET and POST for now...
data,
requestsPerHour,
package subscriptions
import (
"strings"
"time"
"bitbucket.org/uiza-team/uiza-billing-api-server/internal/contracts"
"bitbucket.org/uiza-team/uiza-billing-api-server/internal/dispatcher"
"bitbucket.org/uiza-team/uiza-billing-api-server/internal/dispatcher/events"
stripedtos "bitbucket.org/uiza-team/uiza-billing-api-server/internal/dtos/payment/stripe"
<?php
namespace Framgia\Viblo\Components\Ml;
use Framgia\Viblo\Exceptions\TokenException;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Contracts\Config\Repository as Config;
use Illuminate\Contracts\Encryption\Encrypter;
use Illuminate\Support\Facades\Log;
@rnd-forests
rnd-forests / batch_normalization.py
Created October 26, 2017 08:38
Batch Normalization
import numpy as np
import tensorflow as tf
from datetime import datetime
from functools import partial
from tensorflow.examples.tutorials.mnist import input_data
n_inputs = 784
n_hidden1 = 300
n_hidden2 = 100
n_outputs = 10
@rnd-forests
rnd-forests / gradient_clipping.py
Created October 26, 2017 08:19
Gradient Clipping
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
n_inputs = 784
n_hidden1 = 300
n_hidden2 = 50
n_hidden3 = 50
n_hidden4 = 50
n_hidden5 = 50
n_outputs = 10
@rnd-forests
rnd-forests / api-docs.html
Created September 20, 2017 06:26
Viblo Machine Learning API Documentation
<!DOCTYPE HTML><html><head><title>Viblo Machine Learning API documentation</title><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="generator" content="https://github.com/raml2html/raml2html 6.4.1"><link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/styles/default.min.css"><script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script><script type="text/javascript" src="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/highlight.min.js"></script><script type="text/javascript">
$(document).ready(function() {
$('.page-header pre code, .top-resource-description pre code, .modal-body pre code').each(function(i, block) {
hljs.high
@rnd-forests
rnd-forests / Slimdown.md
Created August 7, 2017 01:25 — forked from jbroadway/Slimdown.md
Slimdown - A simple regex-based Markdown parser.

Slimdown

A very basic regex-based Markdown parser. Supports the following elements (and can be extended via Slimdown::add_rule()):

  • Headers
  • Links
  • Bold
  • Emphasis
  • Deletions
@rnd-forests
rnd-forests / svd.py
Last active June 9, 2020 10:52
SVD++ Recommendations
from __future__ import absolute_import, division, print_function, \
unicode_literals
import os
import math
import pprint
import datetime
import numpy as np
from timeit import default_timer
from collections import defaultdict
@rnd-forests
rnd-forests / videojs.js
Created July 8, 2017 12:48
Video.js directive for Vue.js
import Vue from 'vue'
import _assign from 'lodash/assign'
import _isEqual from 'lodash/isEqual'
const videojs = window.videojs = require('video.js')
const defaults = {
poster: '',
fluid: true,
sources: [],
muted: false,
[
// Remove HTML tags
'/<(.*?)>/' => "$1",
// Remove setext-style headers
'/^[=\-]{2,}\s*$/m' => '',
// Remove footnotes?
'/\[\^.+?\](\: .*?$)?/m' => '',
'/\s{0,2}\[.*?\]: .*?$/' => '',
// Remove images
// '/!\[([^\[]+)\]\(([^\)]+)\)/' => '$1',