Skip to content

Instantly share code, notes, and snippets.

@emmanuelnk
emmanuelnk / expose_docker_container_hostname.sh
Last active December 4, 2020 07:32
Expose docker hostname
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container-name
@emmanuelnk
emmanuelnk / getAmiID.ts
Created November 20, 2020 15:05
Get latest Amazon EC2 AMI image ID just like in the AWS EC2 quick launch console using Node.js
import * as AWS from "aws-sdk"
export const getAMIImageID = async(imageName: string): Promise<string | undefined> => {
AWS.config.update({ region: "us-west-2" })
const ec2 = new AWS.EC2()
// see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/EC2.html#describeImages-property
const params = {
Filters: [
{
@emmanuelnk
emmanuelnk / slack_fedora_install.sh
Created November 6, 2020 11:15
Install the latest version of Slack on Linux from the Terminal
# Fedora
# If you need an international version of Slack, use this URL:
# e.g. Korean:
# https://slack.com/intl/ko-kr/downloads/instructions/fedora
wget -q https://slack.com/downloads/instructions/fedora -O - \
| tr "\t\r\n'" ' "' \
| grep -i -o '<a[^>]\+href[ ]*=[ \t]*"\(ht\|f\)tps\?:[^"]\+"' \
| sed -e 's/^.*"\([^"]\+\)".*$/\1/g' \
@emmanuelnk
emmanuelnk / docker-compose.yml
Created October 22, 2020 14:29 — forked from devzer01/docker-compose.yml
docker-compose mongodb
version: '3'
services:
database:
image: 'mongo'
container_name: 'my-mongo-container' # give your contatner a name
environment:
- MONGO_INITDB_DATABASE=your-database-name # database name you want to make
- MONGO_INITDB_ROOT_USERNAME=my-container-root-username # set your container root username
- MONGO_INITDB_ROOT_PASSWORD=secret # set your contatner root password
volumes:
@emmanuelnk
emmanuelnk / docker_docker_compose_non_root_install.md
Last active October 21, 2020 07:23
Install and use docker and docker-compose on Linux, Ubuntu without SUDO (NON-ROOT)

Are you tired of having to run docker as root? Well look no further, the solution is here. The instructions below were tested on Ubuntu 20.04

First, if you haven't already, install and enable docker:

    sudo apt update && sudo apt install docker.io --yes 
    sudo systemctl enable --now docker

Download latest docker compose (or replace latest in url with desired version number):

@emmanuelnk
emmanuelnk / ui_select_widget.sh
Created August 12, 2020 16:00
Pure BASH interactive CLI/TUI menu (single and multi-select/checkboxes)
#!/bin/bash
# CREDITS
# Author: Markus Geiger <mg@evolution515.net>
# Permission to copy and modify is granted under the Creative Commons Attribution 4.0 license
# Updated by Bluerayne: https://gist.github.com/blurayne/f63c5a8521c0eeab8e9afd8baa45c65e
# INSPIRED BY
# - https://serverfault.com/questions/144939/multi-select-menu-in-bash-script
# https://www.bughunter2k.de/blog/cursor-controlled-selectmenu-in-bash
@emmanuelnk
emmanuelnk / README.md
Created April 17, 2020 07:36 — forked from boneskull/README.md
example of how to debug mocha v4 if hanging

Here's an example of how to debug Mocha v4 if it hangs.

Ensure you're using a Node.js 8 or newer (or any version with async_hooks support).

If you run your test, you'll notice it hangs:

$ mocha test.js
@emmanuelnk
emmanuelnk / master-javascript-interview.md
Created April 8, 2020 09:11 — forked from Geoff-Ford/master-javascript-interview.md
Eric Elliott's Master the JavaScript Interview Series
@emmanuelnk
emmanuelnk / composing-software.md
Created April 8, 2020 09:11 — forked from Geoff-Ford/composing-software.md
Eric Elliott's Composing Software Series

Eric Elliott's "Composing Software" Series

A collection of links to the excellent "Composing Software" series of medium stories by Eric Elliott.

Edit: I see that each post in the series now has index, previous and next links. However, they don't follow a linear flow through all the articles with some pointing back to previous posts effectively locking you in a loop.

@emmanuelnk
emmanuelnk / npm-commands.md
Created February 14, 2020 03:33 — forked from ankurk91/npm-commands.md
Useful npm commands and tricks

npm v3.10 - ◾

If you are learning npm then i would suggest to go for yarn, dont waste your time in learning npm

⚠️ This gist is outdated, but most of the commands are still relevant.

Update npm itself

npm install -g npm
# Downgrade to a specific version