Skip to content

Instantly share code, notes, and snippets.

View jonaskahn's full-sized avatar
🇩🇪
I'm on it

Jonas jonaskahn

🇩🇪
I'm on it
View GitHub Profile

Practice Consul, Nomad in Production Part 1- Setup Cluster

This cluster will be set up for 3 servers, each server will run (Nomad server/client + Consul server/client)

Follow my new instruction here

Practice Consul, Nomad in Production Part 2 - Setup DNS and Make Basic Jobs

Complete the 1st part before you go on SET UP CLUSTER

DEPLOY TRAEFIK

  1. Create service Policy
cd ~ &&  echo "
#! /bin/bash
sudo apt-get install -yq dnsmasq
sudo systemctl disable systemd-resolved.service
echo "DNSStubListener=no" | sudo tee --append /etc/systemd/resolved.conf
sudo systemctl restart systemd-resolved
sudo rm /etc/resolv.conf
echo "nameserver 127.0.0.1" | sudo tee /etc/resolv.conf
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
echo '
port=53
@jonaskahn
jonaskahn / SSL-certs-OSX.md
Created December 12, 2022 14:22 — forked from croxton/SSL-certs-OSX.md
Generate ssl certificates with Subject Alt Names

Generate ssl certificates with Subject Alt Names on OSX

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

DNS.1   = my-project.dev

Additional FQDNs can be added if required:

function exportData() {
const table = $('.table').children("div")
for (let i = 1; i < table.length; i++) {
const rowData = table[i].childNodes
let rank = '';
let name = ''
let country = ''
for (let j = 0; j < rowData[0].childNodes.length; j++) {
const data = rowData[0].childNodes[j]
if ($(data).hasClass('rank')) {

VAR

Scope essentially means where these variables are available for use. var declarations are globally scoped or function/locally scoped.

  • Ex1
var greeter = "hey hi";

if (1) {
    var hello = "hello";
    console.log(hello);
    console.log(greeter);

Let & const

let and const are the block scoped

A block is a chunk of code bounded by {}. A block lives in curly braces. Anything within curly braces is a block.

  • Ex1:
let greeter = "hey hi";

if (1) {

The “if” statement

  • Ex 1:
let year = prompt('In which year was the ECMAScript-2015 specification published?', '');

if (year == 2015) {
  alert( 'You guessed it right!' );
} else {
 alert( 'How can you be so wrong?' ); // any value except 2015

Style

  • Normal style:
result = (a !== null && a !== undefined) ? a : b;
  • Compact style:
result = a ?? b

The result of a ?? b is:

Function declare

function showMessage(from, text) { // parameters: from, text
  alert(from + ': ' + text);
}

showMessage('Ann', 'Hello!'); // Ann: Hello! (*)
showMessage('Ann', "What's up?"); // Ann: What's up? (**)

Parameters