Skip to content

Instantly share code, notes, and snippets.

View bruno-brant's full-sized avatar
🏠
Working from home

Bruno Brant bruno-brant

🏠
Working from home
View GitHub Profile
@bruno-brant
bruno-brant / json.js
Created October 20, 2019 20:15
Get field from json
// Small tool to obtain a field from a JSON file
// Read the JSON from STDIN
var buff = "";
if (process.argv.length <= 1) {
console.error("Must inform the field to be extracted");
process.exit(-1);
}
@bruno-brant
bruno-brant / sample-anemic-model.js
Last active August 22, 2019 13:30
[medium] Coding a Non-Anemic Domain (I)
const server = require('restify').createServer();
const cartRepository = require('../repositories');
server.get('/cart/:cart/total', (req, res) => {
const cartId = Number(req.parameters.cart);
const cart = cartRepository.getCartById(cartId);
const total = cart.items.reduce((total, item) => total + item.price, 0);
res.send(200, { total });
@bruno-brant
bruno-brant / alpine-tools.md
Last active April 2, 2025 15:59
alpine: add curl, telnet ect

Tooling in alpine builds

Pretty usual to have to diagnose docker containers based on alpine distros. But the image never comes with basic tools. How do we add it?

apk update						      # update the local registry
apk add busybox-extras			# install telnet and some other basic tools
apk add curl
@bruno-brant
bruno-brant / push_docker_images_to_openshift.md
Last active February 14, 2024 11:04
How to push docker images to openshift internal registry and create application from it

How to push docker images to openshift internal registry and create application from it

Assuming you have the OCP (openshift container platform) cluster ready and the user has image push permissions on a namespace (ex:- dev)

TL;DR

  • Grab the Cluster IP Address of internal docker registry
  • tag the local image to internal docker registry
  • grab the auth token and login to inter docker registry
> typeof Greeter
'function'
> greeter = new Greeter();
Greeter {}
> typeof greeter
'object'
@bruno-brant
bruno-brant / es6-classes-arent-types--class-greeter
Created April 12, 2017 17:09
ES6 Classes Aren't Type Definitions
class Greeter {
sayHello(name) {
return "Hello, " + name;
}
}