Skip to content

Instantly share code, notes, and snippets.

View btd's full-sized avatar

Denis Bardadym btd

  • AWS
  • Deutschland, München
View GitHub Profile
@btd
btd / new_task.mjs
Created March 6, 2022 20:41
RabbitMq node.js token bucket example
import amqp from "amqplib";
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const connection = await amqp.connect("amqp://localhost");
const channel = await connection.createChannel();
var queue = "task_queue";
var msg = "Hello World!";
@btd
btd / test.js
Created November 12, 2020 10:35
JSEncypt to nodejs crypto and back
const JSEncrypt = require('node-jsencrypt');
const crypto = require('crypto');
const text = ' Some text ÜÄ';
const privateKey = `
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDlOJu6TyygqxfWT7eLtGDwajtNFOb9I5XRb6khyfD1Yt3YiCgQ
WMNW649887VGJiGr/L5i2osbl8C9+WJTeucF+S76xFxdU6jE0NQ+Z+zEdhUTooNR
aY5nZiu5PgDB0ED/ZKBUSLKL7eibMxZtMlUDHjm4gwQco1KRMDSmXSMkDwIDAQAB
@btd
btd / fetch.js
Created February 24, 2020 11:51
"use strict";
const pRetry = require("p-retry");
const _logger = require("ingo-app-log").get("fetch");
const fetch = require("node-fetch");
const uuid = require("uuid").v4;
{"id":"main-network.js","root":{"start":"src/script-network.js","links":[{"source":"src/script-network.js","target":"node_modules/d3-selection/src/index.js"},{"source":"src/script-network.js","target":"node_modules/d3-array/src/index.js"},{"source":"src/script-network.js","target":"node_modules/d3-scale/src/index.js"},{"source":"src/script-network.js","target":"node_modules/d3-force/src/index.js"},{"source":"src/script-network.js","target":"node_modules/bytes/index.js"},{"source":"src/script-network.js","target":"src/tooltip.js"},{"source":"src/script-network.js","target":"src/style/style-network.scss"},{"source":"node_modules/d3-selection/src/index.js","target":"node_modules/d3-selection/src/create.js"},{"source":"node_modules/d3-selection/src/index.js","target":"node_modules/d3-selection/src/creator.js"},{"source":"node_modules/d3-selection/src/index.js","target":"node_modules/d3-selection/src/local.js"},{"source":"node_modules/d3-selection/src/index.js","target":"node_modules/d3-selection/src/matcher.js"},
@btd
btd / Cw.scala
Created December 16, 2018 18:27
package ingo.commons.util
import com.amazonaws.services.cloudwatch.{AmazonCloudWatch, AmazonCloudWatchClientBuilder}
import com.amazonaws.services.cloudwatch.model.{Dimension, MetricDatum, PutMetricDataRequest, StandardUnit}
import ingo.commons.props.DefaultProperties
object CloudWatch {
var client: AmazonCloudWatch = _
#!/usr/bin/env bash
#
# build_module.sh (c) NGINX, Inc. [v0.12 30-Aug-2017] Liam Crilly <liam.crilly@nginx.com>
#
# This script supports apt(8) and yum(8) package managers. Installs the minimum
# necessary prerequisite packages to build 3rd party modules for NGINX Plus.
# Obtains source for module and NGINX OSS, prepares for pkg-oss tool. Inspects
# module configuration and attempts to rewrite for dynamic build if necessary.
# Obtains pkg-oss tool, creates packaging files and copies in module source.
#
@btd
btd / Dockerfile
Last active January 5, 2018 14:57
Nginx + ngx_brotli
FROM alpine:3.7
LABEL maintainer="Denis Bardadym <bardadymchik@gmail.com>"
ENV NGINX_VERSION 1.13.8
ENV BROTLI_COMMIT 5b4769990dc14a2bd466d2599c946c5652cba4b2
ENV NGX_BROTLI_COMMIT 14dede1d3b2827d5135231f101b0af2e287a82d7
RUN CONFIG="\
--prefix=/etc/nginx \
@btd
btd / CookieSessionFilter.scala
Last active June 5, 2017 10:50
Filter to create cookie serialized sessions in servlets container
package ingo.webapp
import javax.servlet._
import javax.servlet.http._
import java.util.Base64
import java.io._
import java.security.SecureRandom
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
@btd
btd / color.js
Last active March 22, 2020 07:31
Color space conversions, RGB, XYZ, CIE Lab
export class RGB {
constructor(r, g, b, a) {
this.r = r;
this.g = g;
this.b = b;
this.a = a;
}
}
function pivotRgb(n) {
@btd
btd / server.js
Created August 15, 2016 11:03
Very basic image proxy
'use strict';
const express = require('express');
const crypto = require('crypto');
const got = require('got');
const signingKey = 'some sort of key here';
const proxyHeaders = [
'content-length',