ctrlaltshiftp
In this simple golang example it appears that we don't need to initialize the wg variable. Why do we do this:
var wg sync.WaitGroup
func main() {
// do some stuff
wg.Wait() // // blocks/waits for waitgroup
}
Currently I am getting this error when I attempt to read a private value of a struct using the reflect package:
panic: reflect.Value.Interface: cannot return value obtained from unexported field or method
So, yeah want to read the private value of a struct:
type Foo struct {
thisIsPrivate string
Your API server should respond with a 405 or 501 status code, not a 404 (When a route handler is missing)
// catch 501 and forward to error handler
app.use((req, res, next) => {
const err = new Error('Not implemented.');
err.status = 501;
This file contains 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
#!/bin/bash | |
cm_env_exp() { | |
rm -rf /tmp/srv-input | |
mkfifo /tmp/srv-input | |
rm -rf /tmp/srv-output | |
mkfifo /tmp/srv-output |
The old way of creating private class data in JS prior to ES6:
export class MyClass {
constructor(){
const privateField = {};
const privateMethod = () => {
return privateField;
The optimal way to create private data on a class:
'use strict';
const privateField = Symbol('private field: for debugging')
const privateMethod = Symbol('private method: this name is just for debugging');
export class MyClass1 {
This file contains 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
NAME | |
cp - Copy files and objects | |
SYNOPSIS | |
gsutil cp [OPTION]... src_url dst_url | |
gsutil cp [OPTION]... src_url... dst_url | |
gsutil cp [OPTION]... -I dst_url |
This file contains 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
Attaching to rydell-mongo-config-03, rydell-mongo-config-02, rydell-mongo-config-01, rydell-shard-03-node-a, rydell-shard-01-node-a, rydell-shard-02-node-a, rydell-router-02, rydell-router-01, rydell-shard-03-node-b, rydell-shard-01-node-b, rydell-shard-02-node-b, rydell-shard-02-node-c, rydell-shard-03-node-c, rydell-shard-01-node-c | |
[33mrydell-mongo-config-02 |[0m 2019-09-10T02:57:20.550+0000 I STORAGE [main] Max cache overflow file size custom option: 0 | |
[33mrydell-mongo-config-02 |[0m 2019-09-10T02:57:20.552+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none' | |
[33mrydell-mongo-config-02 |[0m 2019-09-10T02:57:20.555+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/configdb 64-bit host=c569f8378ff2 | |
[33mrydell-mongo-config-02 |[0m 2019-09-10T02:57:20.555+0000 I CONTROL [initandlisten] db version v4.0.12 | |
[33mrydell-mongo-config-02 |[0m 2019-09-10T02:57:20.555+0000 I CONTROL [initandlisten] git version: |
Here is some node.js code:
#!/usr/bin/env node
const fs = require('fs');
const header = '#!/usr/bin/env bash\n\n';
try {
const bytes = fs.writeSync(3, header, 0);