Small React component for counting numbers up to a certain value in a specified duration in ms. Useful for creating animated dashboards etc.
<Counter countFrom={0} countTo={123} durationMs={400}/>
var express = require("express"); | |
var app = express(); | |
const setMyInfo = (text) => { | |
return (req, res, next) => { | |
req.myInfo = text; | |
next(); | |
}; | |
}; |
# save as ./github/workflows/git-ci-build.yml | |
# make sure that 'test-coverage' generates the coverage reports (lcov) | |
name: git-ci-build | |
on: | |
[push] | |
jobs: | |
build: |
An instance template with more than one NIC obviously can't be created in the GCP web console. But it could easily be achieved using the gcloud
CLI with consecutive --network-interface
options.
gcloud compute --project=YOUR_PROJECT instance-templates create multi-nic-vm-template --machine-type=e2-micro --network-interface=subnet=projects/YOUR_PROJECT/regions/europe-west3/subnetworks/my-subnet-1,no-address --network-interface=subnet=projects/YOUR_PROJECT/regions/europe-west3/subnetworks/my-subnet-2,no-address --maintenance-policy=MIGRATE --image=my-image-1 --image-project=YOUR_PROJECT --boot-disk-size=10GB --boot-disk-type=pd-standard --boot-disk-device-name=instance-template-1 --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any --tags=allow-health-check
In this example I specified two subnets that belong to different VPC's.
#!/bin/bash | |
# Creates time series dummy data in a CSV with random hourly values. | |
# | |
# timeseries: array of name|from|to for the time series | |
# -> name: name of the series (string) | |
# -> from: lower limit of the hourly values (number) | |
# -> to: upper limit of the hourly values (number) | |
# amount: number of hourly values to create for each series, 24 for one complete day, 24*365 for a year etc. | |
# startdate: date-time of the first hour |
Small functional React component for counting numbers up to a certain value in a specified duration in ms. Useful for creating animated dashboards etc.
Uses React hooks useEffect
, useState
and useRef
. Good example on how to pass props to a useEffect
hook without declaring them as dependencies and how to deal with setInterval
in functional components.
<CounterFunc countFrom={0} countTo={123} durationMs={400} />
const got = require('got'); | |
const stream = require('stream'); | |
const fs = require('fs'); | |
const { promisify } = require('util'); | |
const pipeline = promisify(stream.pipeline); | |
// instantiate the download stream - use options to set authorization header etc. if needed | |
let downStream = got.stream('https://example.com/download'); | |
downStream.on('response', response => { |
A simple setup for using nginx to avoid CORS errors during local development without the need of code changes.
Let's assume you are developing a frontend and a backend service belonging together. It's a good practice to have those two projects separated to decouple development, deployment, patching etc.
At the end, both parts mostly would run under one domain but in different contexts, e.g.: