Skip to content

Instantly share code, notes, and snippets.

View ealipio's full-sized avatar
:bowtie:
:)

Eisson ealipio

:bowtie:
:)
View GitHub Profile

docker

docker run ubuntu # download the image and run it
docker pull ubuntu # download the image only
# ----------------------------------------------------
docker ps   # list all running containers only     
docker ps -a  # list all containers
# ----------------------------------------------------
docker stop <container ID | name> # stops docker container
docker kill <container ID | name>
// Write an algorithm to check if the sum of any two elements in an
// array/list matches a given target, and return their indexes in
// an array.
//
// Parameters: [0, 6, 8, 4], 10
// Result: [ 1, 3]
// Parameters: [20, 18, 5, 4, 10, 22], 42
// Result: [ 0, 5]
@ealipio
ealipio / highFreq.js
Created September 25, 2019 04:18
get the most repeated number in an array
arr = [12, 10, 8, 12, 7, 6, 4, 10, 12];
const unique = [...new Set(arr)]
let obj = {};
for(let i=0;i<arr.length;i++) {
obj[arr[i]] = (obj[arr[i]] || 0 )+1
}
const max = Math.max(...Object.values(obj))
const [highFreq] = unique.filter(i => obj[i] === max)
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const printMessagetoUser = ({name, age}) => {
if (!isNaN(age)) {
const yearOf100 = new Date().getFullYear() + (100 - age);
I get this error installing docker in debian WSL 2
The docker installer uses iptables for nat. Unfortunately Debian uses nftables. You can convert the entries over to nftables or just setup Debian to use the legacy iptables.
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
dockerd, should start fine after switching to iptables-legacy.
sudo service docker start