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}/>
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-checkIn this example I specified two subnets that belong to different VPC's.
| # 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: |
| function isOdd(x) { | |
| return new Promise((resolve, reject) => { | |
| if (x == 11) throw new Error('11 is not allowed!'); | |
| if (x % 2) { | |
| resolve(x.toString() + ' is odd') | |
| } | |
| else { | |
| reject(new Error(x.toString() + ' is even')); | |
| } | |
| }); |
| git rm -r --cached . | |
| git add . |
| 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 => { |
| #!/bin/bash | |
| # set URL to test here | |
| url=YOUR_URL_HERE | |
| # set test iterations here: requests|concurrent | |
| declare -a iterations=("1|1" "10|10" "100|20" "100|100" "1000|50" "1000|100") | |
| # first argument is the bearer token | |
| if [ -z "$1" ] |
| const crypto = require('crypto'); | |
| const algorithm = 'aes-256-cbc'; | |
| const dbURI = 'mongodb://localhost/encryptiontest'; | |
| const dbOptions = { | |
| user: 'encryptiontest', | |
| pass: 'test', | |
| useNewUrlParser: true, | |
| useCreateIndex: true, | |
| useFindAndModify: false, |
| function jsonToHtmlList(obj, level = 0) { | |
| if (level == 0) { | |
| console.log('<ul>'); | |
| } | |
| else { | |
| console.log((' ').repeat(level) + '<ul class=\"nested\">'); | |
| } | |
| Object.entries(obj).forEach(([key, val]) => { | |
| if (val !== null && typeof val == 'object' && !Array.isArray(val)) { | |
| console.log((' ').repeat(level) + ' <li class=\"caret\">Key: ' + key + '</li>') |