Skip to content

Instantly share code, notes, and snippets.

Coding for life and fun

Jakub Zomerfeld devzom

Coding for life and fun
View GitHub Profile
View promises.js
function loadScript(src) {
return new Promise(function(resolve, reject) {
let script = document.createElement('script');
script.src = src;
script.onload = () => resolve(script);
script.onerror = () => reject(new Error("Script load error: " + src));
devzom /
Last active Sep 25, 2021 — forked from jmcaldera/
Multiple SSH Keys macOS

Multiple SSH Keys on same client

Check if you have existing keys by opening the terminal and entering: ssh-add -l OR ls -al ~/.ssh and check for any file called (usually) id_rsa or similar

Identify the host you're using your current key for. You probably added this key to, for example your github or gitlab account. We will use this later on.

If you don't have a config file on ~/.ssh folder, you will need to create one. We'll get back to this later.

devzom / MacOs-Laravel-var_www-symlink-permissions.txt
Created Sep 25, 2021
MacOS BigSur add permission to /var/www folder to use with Laravel symlink
View MacOs-Laravel-var_www-symlink-permissions.txt
devzom / add-ssh-on-ubuntu.txt
Created Dec 20, 2021
SSH: How to use existing SSH key on my newly installed Ubuntu
View add-ssh-on-ubuntu.txt
cp /path/to/my/key/id_rsa ~/.ssh/id_rsa
cp /path/to/my/key/ ~/.ssh/
# change permissions on file
sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/
# start the ssh-agent in the background
eval $(ssh-agent -s)
# make ssh agent to actually use copied key
ssh-add ~/.ssh/id_rsa
devzom / compareEnvs.js
Created Jan 14, 2022
javascript: Function to compare different .env files
View compareEnvs.js
* Created: 14/1/2022 by Jakub Zomerfeld /
const fs = require('fs')
const path = require('path')
const dotenv = require('dotenv')
devzom / generate-seo-robots-agents-sitemap.js
Last active Jan 19, 2022
JS: Nuxt: Generate sitemap UserAgent based on provided array
View generate-seo-robots-agents-sitemap.js
* @created: 18/12/2021
* @author Jakub []
* @summary Utils funtion to generate an array of
* UserAgents provided in structured schema
* to use with Robots Nuxt module
const agentsArray = [
devzom / nuxt_JSON-LD_head-SEO.js
Created Mar 5, 2022
Nuxt: Add JSON-LD schema markup for SEO in Nuxt.js
View nuxt_JSON-LD_head-SEO.js
return ({
description:'Description of the site'
title: 'Home page',
meta: [
devzom / index.html
Last active Mar 16, 2022
CSS: Animated smooth anchor scroll with anchor margin
View index.html
<!-- step 3 -->
<!-- It's important to add tabindex="-1" to all anchor tags -->
<section id="section1" tabindex="-1">Section 1</section>
devzom /
Last active Mar 16, 2022
docker: Check if Docker container exist and delete it
# Goal of tghis script is to prompt for Docker container name, if it's skipped it will used infile defined name of container and then will search for specific container and delete it.
# Set container default name as variable
echo -n "Enter Docker container name (if skipped default from file will be used): "
read containerName
# Check if prompted value isNotEmpty
if [ $containerName ]; then
devzom /
Created Mar 16, 2022
bash: Read .env file variable in Bash
# this will skip search for lines with variable starting with # (hashtag) ex: # VAR1 as its commented out
# Ex: we have .env file with variables:
# #VAR1=123
# VAR2=xyz
# NPM_TOKEN=12312323fdf21313
export "$(grep -vE "^(#.*|\s*)$" .env)"
# didn't respond VAR1 as it contain #, so it's commented out.
# responds with single value ex NPM_TOKEN: