Skip to content

Instantly share code, notes, and snippets.

Learning the sh*t out of things

Noud Adrichem noudadrichem

Learning the sh*t out of things
View GitHub Profile
echo "Installing microk8s 1.18/stable for $(whoami)"
sudo snap install microk8s --classic --channel=1.18/stable
sudo microk8s start
sudo microk8s status --wait-ready
sudo microk8s.kubectl get nodes
sudo microk8s.kubectl get all -o wide
echo "--DONE--"
echo "Creating 3gb swap for $(whoami)"
free -h
sudo fallocate -l 3G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
free -h
sudo sysctl vm.swappiness=10
View wp-docker-compose.yml
version: '2'
- db
image: wordpress:4.7.1
restart: always
- ./wp-content:/var/www/html/wp-content
noudadrichem /
Created Jan 13, 2021
Setup docker on Ubuntu 20.04
change NAME
echo '=> Installing docker...'
# Docker
curl -sSL | sh
sudo usermod -aG docker NAME
docker run hello-world
echo '=> Installing compose...'
# Compose
View promise.settimeout.ts
import {promisify} from 'util';
const wait = promisify(setTimeout)
await wait(5000);
noudadrichem / reset.css
Created Sep 23, 2020
Applies 'reset' overrides to the HTML document.
View reset.css
View meta.service.ts
import Logger from "../lib/logger";
import axios from "axios";
import { createCanvas, loadImage, registerFont } from "canvas";
import path from "path";
import ColorThief from "colorthief";
import { uploadImage } from "../resolvers/imgResolver";
import { KeycapsetModel } from "../models";
registerFont(__dirname + "../../../static/Rubik-SemiBold.ttf", {
family: "Rubik Semi",
View oracledb
docker run -d -p 49160:22 -p 49162:8080 -p 49161 -v oracledb thebookpeople/oracle-xe-11g
noudadrichem / isColourDarkOrLight.ts
Created Sep 7, 2020
Gives back tags based on RGB code if it's light or dark
View isColourDarkOrLight.ts
public isColourDarkOrLight(rgb: number[]): 'light' | 'dark' {
// RGB to HSP equation:
const [r, g, b] = rgb;
const hsp = Math.sqrt(
0.299 * (r * r) +
0.587 * (g * g) +
0.114 * (b * b)
return hsp > 127.5 ? 'light' : 'dark';
noudadrichem / toSlug.ts
Last active Jul 22, 2020
Escape invalid chars in string to create a slug
View toSlug.ts
const toSlug = 'every thing you $ want. To b3 eScaped';
const slug = toSlug.toLowerCase()
.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
.replace(/\s+/g, '-') // collapse whitespace and replace by -
.replace(/-+/g, '-'); // collapse dashes