Skip to content

Instantly share code, notes, and snippets.

View Belrestro's full-sized avatar
🇺🇦

Andrew Vorobiov Belrestro

🇺🇦
  • Kiev
View GitHub Profile
var simMath = {
memo:{},
operation:function(array, method){
return Array.prototype.join.call(array, method);
},
calculate:function(array, method){
return Array.prototype.reduce.call(array, method);
},
plus: function(){
var operation = this.operation(arguments, '+');
@Belrestro
Belrestro / gulpfile.js
Created January 10, 2017 12:03
Gulp config
var gulp = require('gulp');
var watch = require('gulp-watch');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var cleanCSS = require('gulp-clean-css');
var rename = require('gulp-rename');
var ftp = require('gulp-ftp');
/* */
var ftpAccess = {
$(document).ready(function() {
$("a[href^='#']:not([data-toggle='tab']").click(function() {
var anchor = $(this).attr("href");
if ($(anchor).length != 0) {
$("html, body").animate({scrollTop: $(anchor).offset().top - ($('header').height()+10)}, 500);
}
return false;
});
});
const mapToType = (parent, depth = 2) => {
const map = (object, lvl = 0) => {
if (object instanceof Array) object = object[0];
const props = {};
for (let key in object) {
const prop = object[key];
let type = typeof prop;
if (type === 'object') {
type = prop instanceof Array ? 'array' : 'object';
export class Decoder {
getEmptyChunk () {
return {
name: '',
length: 0
};
}
readString (data, offset, length) {
return data.slice(offset, offset + length);
@Belrestro
Belrestro / simple_synth.js
Last active July 12, 2018 07:26
oscillator experiment
(() => {
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
const noteMap = {
'90': {
key: 'Z',
note: 'C',
freq: 261.63
},
'83': {
const http = require("http");
const path = require("path");
const fs = require("fs");
const busboy = require('connect-busboy');
const express = require("express");
const STORE_FOLDER = 'public';
const app = express();
app.use(busboy({
highWaterMark : 2 * 1024 * 1024 // alot
@Belrestro
Belrestro / example.py
Created May 13, 2019 09:27
train rasa core, and rasa nlu models programmatically rasa.core 0.14.3 nlu 0.15
from rasa_core.agent import Agent
from rasa_core.policies import KerasPolicy
from rasa_nlu.training_data import load_data
from rasa_nlu import config
from rasa_nlu.model import Trainer
import datetime
def _archive_name (type, environment):
t = datetime.datetime.now()
timestring = t.strftime('%Y%m%d-%H%M%S')
@Belrestro
Belrestro / run_core.sh
Created May 15, 2019 15:28
not so specific guide how to run core on a specific branch
# assuming you have pyhton 3.7-stretch
DIR=./
git clone --branch tags/0.14.3 git@github.com:RasaHQ/rasa_core.git $DIR \
&& cd $DIR
pip install pip==19.1
pip install -r requirements.txt
@Belrestro
Belrestro / generate.sh
Created August 20, 2019 11:57
Generate certificate for localhost
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")