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
@Piotr1215
Piotr1215 / connect-k8s.md
Last active April 18, 2022 12:22
Keep cluster connections separate

How to keep cluster connections cleanly separated

With time the .kube/config file will contain a mix of dev, test and prod cluster references. It is easy to forget switching off from a prod cluster context and make a mistake and run for example kubectl delete ns crossplane-system.

Direnv based setup

Use the following setup to avoid these kinds of errors and keep clusters separate.

Install direnv

lambda function
----
exports.handler = async (event) => {
console.log(event)
const customerId = event.pathParameters.customerId;
const customer = {'customerId': customerId, 'customerName': "Customer " + customerId };
const response = {
statusCode: 200,
// Uncomment below to enable CORS requests
headers: {
@nicc777
nicc777 / k3s-multipass.sh
Last active May 9, 2024 09:37 — 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
@lukeplausin
lukeplausin / load_any_yaml_tag.py
Last active July 22, 2023 09:01
Load any YAML tag including custom tags in python with PyYAML
# Inspired by this great answer...
# https://stackoverflow.com/a/60785401
import yaml
class SafeUnknownConstructor(yaml.constructor.SafeConstructor):
def __init__(self):
yaml.constructor.SafeConstructor.__init__(self)
def construct_undefined(self, node):

Managing Gists Locally

by Danny Quah, May 2020 (revised Jan 2022)

Through the Embed instruction or plugin, Gist snippets on GitHub can conveniently provide posts on Medium, WordPress, and elsewhere supplementary information (lines of code, images, Markdown-created tables, and so on). But while Gist snippets on GitHub can be managed directly via browser or through something like [Gisto][], a user might also wish to manipulate them offline. This last is for many of the same reasons that a user seeks to clone a git repo to their local filesystem, modify it locally, and then only subsequently push changes back up to GitHub.

Here's how to do this:

Create the gist on GitHub and then clone it to your local filesystem:

@lucj
lucj / k3s-multipass.sh
Created December 17, 2019 21:16
Setup a k3s kubernetes cluster using Multipass VMs
for node in node1 node2 node3;do
multipass launch -n $node
done
# Init cluster on node1
multipass exec node1 -- bash -c "curl -sfL https://get.k3s.io | sh -"
# Get node1's IP
IP=$(multipass info node1 | grep IPv4 | awk '{print $2}')
@rjeczalik
rjeczalik / how-to-find-forks-of-deleted-repo.md
Created August 26, 2019 16:39
How to find forks of a deleted repository?
@scragly
scragly / learning_dpy.md
Last active March 27, 2024 21:45
Learning discord.py
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 5, 2024 19:12
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@veselosky
veselosky / s3gzip.py
Last active May 8, 2023 21:42
How to store and retrieve gzip-compressed objects in AWS S3
# vim: set fileencoding=utf-8 :
#
# How to store and retrieve gzip-compressed objects in AWS S3
###########################################################################
#
# Copyright 2015 Vince Veselosky and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at