This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// No middleware, just pur functions | |
import getBodyFromReq from 'pureBodyParser'; | |
import getQueryFromReq from 'pureQueryParser'; | |
import sendToRes from 'pureResponseMaker'; | |
// Use dependency injection for required services | |
// app/config/timer just come from this function caller | |
module.exports = ({ app, config, timer}) => { | |
app.post((req, res) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"description": "WMG web services running altogether", | |
"version": "5.6.0", | |
"title": "infrastructure-wmg" | |
}, | |
"host": "localhost:1664", | |
"schemes": [ | |
"https" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getInstance, initializer } from 'knifecycle'; | |
import uuid from 'uuid'; | |
import { initDelayService } from 'common-services'; | |
import { | |
initRouter, | |
initHTTP, | |
initHTTPTransaction | |
} from 'swagger-http-router'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"log" | |
"math" | |
"os" | |
"path/filepath" | |
"strconv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildMessage(values) { | |
const DIFF = Math.pow(2, 9); // 512 | |
const MAX_PRECISION = 4; // 512 * 4 allows to encode 300 <= x <= 1100 | |
const maxIndex = values.indexOf(Math.max(...values)); | |
const minIndex = values.indexOf(Math.min(...values)); | |
const maxDiff = values.reduce( | |
(diff, v) => Math.max(v - values[minIndex], diff), | |
0 | |
); | |
const precision = Math.ceil(maxDiff / DIFF); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar tvf $(npm pack) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Knifecycle, constant, autoService, autoProvider } from 'knifecycle'; | |
// Initialize the injector | |
const $ = new Knifecycle(); | |
// Declare constants | |
$.register(constant('FTP_CONFIG', { user: 'test', password: 'test' })); | |
$.register(constant('DB_CONFIG', { user: 'test', password: 'test' })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Knifecycle, constant, autoService, service } from 'knifecycle'; | |
// Initialize the injector | |
const $ = new Knifecycle(); | |
// Declare constants | |
$.register(constant('FTP_CONFIG', { user: 'test', password: 'test' })); | |
$.register(constant('FTP_CONFIG2', { user: 'test2', password: 'test2' })); | |
// Declare services |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<json:object> | |
<json:string name="text">Hello world!</json:string> | |
</json:object> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run \ | |
-v $(pwd)/pgsql/docs:/home/schcrwlr/share \ | |
--name schemacrawler \ | |
--rm -i -t \ | |
--entrypoint=/bin/bash schemacrawler/schemacrawler \ | |
-c "/opt/schemacrawler/schemacrawler.sh --command=schema --output-format=png --output-file=/home/schcrwlr/share/graph.png --server=postgresql --host=\$(/sbin/ip route|awk '/default/ { print \$3 }') --port=15432 --database=diagrams --schemas=public --user=postgres --password=mysecretpassword --info-level=maximum --log-level=ALL" |