Skip to content

Instantly share code, notes, and snippets.

@lutogin
lutogin / cli.docker.sh
Created December 20, 2021 21:41 — forked from LeCoupa/cli.docker.sh
Docker Cheatsheet + Tips & Tricks --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
docker build -t friendlyname . # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode
docker exec -it [container-id] bash # Enter a running container
docker ps # See a list of all running containers
docker stop <hash> # Gracefully stop the specified container
docker ps -a # See a list of all containers, even the ones not running
docker kill <hash> # Force shutdown of the specified container
docker rm <hash> # Remove the specified container from this machine
docker rm $(docker ps -a -q) # Remove all containers from this machine
@lutogin
lutogin / nodejs-cheatsheet.js
Created December 20, 2021 21:41 — forked from LeCoupa/nodejs-cheatsheet.js
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@lutogin
lutogin / factorialCallbackTest.js
Created March 18, 2021 22:38 — forked from johnhaley81/factorialCallbackTest.js
Factorial promise/generator test
function factorialCallback(acc, n, callback) {
if (n === 0) {
callback(acc);
} else {
setImmediate(() => factorialCallback(acc * n, n - 1, callback));
}
}
function timedFactorialCallback(n) {
const start = new Date();
@lutogin
lutogin / docker-compose.yml
Created October 15, 2020 09:51 — forked from shabbirdwd53/docker-compose.yml
Kakfa Server installation using Docker
version: "3"
services:
zookeeper:
image: 'bitnami/zookeeper:latest'
container_name: zookeeper
ports:
- '2181:2181'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
kafka:
@lutogin
lutogin / getWeek.js
Created March 21, 2020 13:26 — forked from dblock/getWeek.js
get week of the year in JavaScript
function( d ) {
// Create a copy of this date object
var target = new Date(d.valueOf());
// ISO week date weeks start on monday
// so correct the day number
var dayNr = (d.getDay() + 6) % 7;
// Set the target to the thursday of this week so the