Skip to content

Instantly share code, notes, and snippets.

View NekoTashi's full-sized avatar

Christopher Rubio Márquez NekoTashi

View GitHub Profile

Create a multi-node kind cluster and with a different kubernetes version than default

The instructions in this tutorial are not WSL2 specific, but if you would like to see how to get started with kind in WSL2 (and afterwards follow along with this tutorial), do have a look at this video.

How to create a local multi-node Kubernetes cluster with kind

In order to create a multi-node cluster with kind, we need to create a configuration file. Let's say we want to create a 3 node cluster, 1 control-plane and 2 workers, we would then create the following configuration file (you can save it as kind-config.yaml):

kind: Cluster
@hanpama
hanpama / djargon2i.go
Created October 4, 2019 01:41
Django Argon2PasswordHasher compatible password hasher in Golang
package djargon2i
import (
"crypto/rand"
"crypto/subtle"
"encoding/base64"
"errors"
"fmt"
"strings"
@weibeld
weibeld / kubernetes-books.md
Last active November 8, 2022 21:37
List of Kubernetes books
@RainJayTsai
RainJayTsai / minimize_docker_python_application
Last active May 26, 2022 06:25
using docker BUILDKIT example, cache pip and mount temp whl to install. tensorflow python3.6
# syntax = docker/dockerfile:experimental
FROM python:3.6 as base
######################################
FROM base as builder
ENV PYTHONPATH=$PYTHONPATH:/install/lib/python3.6/site-packages/
# bind a wheel and install it
@wsvincent
wsvincent / admin.py
Created November 2, 2018 19:23
Django Custom User Model for any new project
# users/admin.py
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
from .forms import CustomUserCreationForm, CustomUserChangeForm
from .models import CustomUser
class CustomUserAdmin(UserAdmin):
add_form = CustomUserCreationForm
@bradtraversy
bradtraversy / django_deploy.md
Last active April 4, 2024 11:28
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

@jsomers
jsomers / websockets.md
Created September 27, 2018 12:50
Using websockets to easily build GUIs for Python programs

Using websockets to easily build GUIs for Python programs

I recently built a small agent-based model using Python and wanted to visualize the model in action. But as much as Python is an ideal tool for scientific computation (numpy, scipy, matplotlib), it's not as good for dynamic visualization (pygame?).

You know what's a very mature and flexible tool for drawing graphics? The DOM! For simple graphics you can use HTML and CSS; for more complicated stuff you can use Canvas, SVG, or WebGL. There are countless frameworks, libraries, and tutorials to help you draw exactly what you need. In my case, this was the animation I wanted:

high-priority

(Each row represents a "worker" in my model, and each rectangle represents a "task.")

@ddevault
ddevault / Makefile
Last active February 20, 2024 14:17
Tiny Wayland compositor
WAYLAND_PROTOCOLS=/usr/share/wayland-protocols
# wayland-scanner is a tool which generates C headers and rigging for Wayland
# protocols, which are specified in XML. wlroots requires you to rig these up
# to your build system yourself and provide them in the include path.
xdg-shell-protocol.h:
wayland-scanner server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.c: xdg-shell-protocol.h
# ---- Base python ----
FROM python:3.6 AS base
# Create app directory
WORKDIR /app
# ---- Dependencies ----
FROM base AS dependencies
COPY gunicorn_app/requirements.txt ./
# install app dependencies
RUN pip install -r requirements.txt
@nguyenkims
nguyenkims / log.py
Last active February 13, 2024 07:59
Basic example on how setup a Python logger
import logging
import sys
from logging.handlers import TimedRotatingFileHandler
FORMATTER = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
LOG_FILE = "my_app.log"
def get_console_handler():
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setFormatter(FORMATTER)