Skip to content

Instantly share code, notes, and snippets.

View iximiuz's full-sized avatar
🪲

Ivan Velichko iximiuz

🪲
View GitHub Profile
$ kubectl label po green-5c8f858bbb-mqxrd app=blue pod-template-hash=5bc56d75b --overwrite
NAME                     READY   STATUS              RESTARTS   AGE   LABELS
blue-5bc56d75b-5j462     1/1     Running             0          15m   app=blue,pod-template-hash=5bc56d75b
blue-5bc56d75b-wwn8c     1/1     Terminating         0          27s   app=blue,pod-template-hash=5bc56d75b
green-5c8f858bbb-bsjwv   0/1     ContainerCreating   0          0s    app=green,pod-template-hash=5c8f858bbb
green-5c8f858bbb-mqxrd 1/1 Running 0 15m app=blue,pod-template-hash=5bc56d75b
@aojea
aojea / KIND_Networking.md
Last active September 19, 2024 17:25
Use KIND to emulate complex network scenarios

Networking scenarios [Linux Only]

KIND runs Kubernetes cluster in Docker, and leverages Docker networking for all the network features: port mapping, IPv6, containers connectivity, etc.

Docker Networking

KIND uses a docker user defined network.

It creates a bridge named kind

#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
@zserge
zserge / guest.S
Created May 10, 2020 08:41
A tiny KVM host to run a 16-bit real mode "kernel"
# A tiny 16-bit guest "kernel" that infinitely prints an incremented number to the debug port
#
# Build it:
#
# as -32 guest.S -o guest.o
# ld -m elf_i386 --oformat binary -N -e _start -Ttext 0x10000 -o guest guest.o
#
.globl _start
@OrKoN
OrKoN / index.js
Last active July 24, 2019 08:20
Autonomous LumberJack
var c = document.getElementById('canvas_wrap').children[0];
var gl = c.getContext('webgl', { preserveDrawingBuffer: true });
function getColor(pixels, y) {
var color =
decimalToHex(pixels[y * 4], 2) +
decimalToHex(pixels[y * 4 + 1], 2) +
decimalToHex(pixels[y * 4 + 2], 2);
return color;
}
@sergey-shambir
sergey-shambir / install-clang.sh
Last active November 20, 2023 10:16
install clang on Debian 9
# Add apt.llvm.org repository and install clang
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch main"
sudo apt-get update
sudo apt-get install -y clang clang-format clang-tidy lldb libc++-8-dev libc++abi-8-dev
# Check version
clang --version
clang++ --version
@rsperl
rsperl / Makefile #snippet
Last active April 17, 2024 23:02
self-documenting makefile with colors
SHELL=/bin/bash
# to see all colors, run
# bash -c 'for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; echo =$c; done'
# the first 15 entries are the 8-bit colors
# define standard colors
ifneq (,$(findstring xterm,${TERM}))
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
@pulyaevskiy
pulyaevskiy / annotated_editable.dart
Created June 28, 2018 19:39
AnnotatedEditableText
import 'package:flutter/widgets.dart';
class Annotation extends Comparable<Annotation> {
Annotation({@required this.range, this.style});
final TextRange range;
final TextStyle style;
@override
int compareTo(Annotation other) {
return range.start.compareTo(other.range.start);

Libuv and libev, two I/O libraries with similar names, recently had the privilege to use both libraries to write something. Now let's talk about my own subjective expression of common and different points.

The topic of high-performance network programming has been discussed. Asynchronous, asynchronous, or asynchronous. Whether it is epoll or kqueue, it is always indispensable to the asynchronous topic.

Libuv is asynchronous, and libev is synchronous multiplexing IO multiplexing.

Libev is a simple encapsulation of system I/O reuse. Basically, it solves the problem of different APIs between epoll and kqueuq. Ensure that programs written using livev's API can run on most *nix platforms. However, the disadvantages of libev are also obvious. Because it basically just encapsulates the Event Library, it is inconvenient to use. For example, accept(3) requires manual setnonblocking after connection. EAGAIN, EWOULDBLOCK, and EINTER need to be detected when reading from a socket. This is a

@posener
posener / go-table-driven-tests-parallel.md
Last active September 16, 2024 16:35
Be Careful with Table Driven Tests and t.Parallel()

Be Careful with Table Driven Tests and t.Parallel()

We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.

Let’s create our table driven test, for convenience, I chose to use t.Log as the test function. Notice that we don't have any assertion in this test, it is not needed to for the demonstration.

func TestTLog(t *testing.T) {
	t.Parallel()