Skip to content

Instantly share code, notes, and snippets.

View nicc777's full-sized avatar
🏠
Working from home

Nico Coetzee nicc777

🏠
Working from home
  • Utrecht, Netherlands
View GitHub Profile
@nicc777
nicc777 / index.html
Created September 6, 2019 04:43
Udemy React Course - Section 1.4
<div id="app"></div>
@nicc777
nicc777 / jsObjRefVsCopy.js
Created September 8, 2019 11:53
JavaScript - Object reference vs copy
const person = {
name: 'Pete'
};
const newPerson1 = person; // person is referenced (not a copy)
const newPerson2 = {
...person // perons is spread (copied) and the reference is not used
};
@nicc777
nicc777 / jsListFunctionsExample.js
Created September 9, 2019 04:59
Javascript list functions example
// Also refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
const numbers = [1, 2, 3];
const doubleNumbers = numbers.map((num) => {
return num * 2;
});
console.log(numbers);
console.log(doubleNumbers);
@nicc777
nicc777 / s3_size_summary_idea.md
Created April 10, 2020 04:29
Solution for getting all S3 buckets and their size

So, the concept is to get a summary of the size of each S3 bucket - almost like the du command on Linux.

The code concept from below is still untested, but I will soon test it and hopefulle have a modified general purpose utility for wider use.

Basic code from stackexchange.com:

#!/bin/bash
aws_profile=('profile1' 'profile2' 'profile3');

#loop AWS profiles
@nicc777
nicc777 / initial_test.md
Created May 11, 2020 14:46
Notes around Clockfy API and Python requests

The Clockify API is well documented and uses a straight forward REST API

Here is a quick proof of concept run:

$ export API_KEY="<your-key>"
$ python3
Python 3.7.7 (default, Mar 10 2020, 15:43:33) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
@nicc777
nicc777 / k3s-multipass.sh
Last active October 29, 2024 11:53 — forked from lucj/k3s-multipass.sh
Setup a k3s kubernetes cluster using Multipass VMs
#!/usr/bin/env bash
# Refer to https://github.com/k3s-io/k3s/releases for your prefered release
export INSTALL_K3S_VERSION="v1.24.10+k3s1"
for node in node1 node2 node3;do
multipass launch -n $node -c 2 -m 4G
done
# Init cluster on node1
@nicc777
nicc777 / ubuntu_node_latest.md
Last active June 4, 2020 07:41
Getting the latest Node Installation on Ubuntu (18.04)

Context

I often need to play and experiment and using different environments help. In the era of virtualisation we have many options. For this exercise, I'm using Ubuntu Multipass which allow you to vey quickly create virtual machines.

The steps described here will not only install the latest version of Node.js but will also setup the environment to install any global packages in ~/.npm-packages.

Starting a new Multipass Ubuntu Instance

$ multipass launch -n nodejs
@nicc777
nicc777 / reinstall_command_line_tools.md
Created June 8, 2020 09:39
Various hacks you can try on the Mac if things don't work

Found this gem on medium

Can help with problems like:

gyp: No Xcode or CLT version detected!
gyp ERR! configure error

TL;DR

@nicc777
nicc777 / get_kubectl.sh
Last active May 9, 2022 19:16
Get latest kubectl (Linux)
#!/bin/sh
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
mkdir -p ~/opt/bin
chmod 700 kubectl
mv kubectl ~/opt/bin
@nicc777
nicc777 / clean-up-boot-partition-ubuntu.md
Created March 4, 2021 08:58 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r