Skip to content

Instantly share code, notes, and snippets.

View andrewloux's full-sized avatar

Andrew Louis andrewloux

View GitHub Profile
@andrewloux
andrewloux / check.sh
Created May 28, 2024 14:22
Dump JAR Dependencies
#!/bin/bash
JAR_FILE=$1
EXTRACT_DIR="extracted"
# Ensure the extracted directory exists
mkdir -p $EXTRACT_DIR
# Extract the jar file
unzip -q "$JAR_FILE" -d $EXTRACT_DIR
@andrewloux
andrewloux / restart.sh
Created May 2, 2024 11:56
Restart all pods in K8s cluster
#!/bin/bash
## Usage: ./restart.sh --env staging
# Check if the --env argument is provided
if [ "$#" -ne 2 ] || [ "$1" != "--env" ]; then
echo "Usage: $0 --env <environment>"
exit 1
fi
@andrewloux
andrewloux / hasura.sh
Last active December 8, 2022 03:19
Hasura wrapper that pins a specific version
#!/bin/bash
set -e
set -o pipefail
# This is a simple wrapper script for the "hasura" command that enforces the version
# and bails out if the hasura version is incorrect.
# Replace "hasura" with the actual path to the hasura binary, if necessary.
HASURA_BINARY="hasura"
@andrewloux
andrewloux / propgate_context_cancellations.go
Last active June 5, 2021 00:14
Playing around with propagating Temporal WorkflowRun context cancellations
type WorkflowRun interface {
client.WorkflowRun
}
type customWorkflowRun struct {
client.WorkflowRun
cancelWorkflowFunc context.CancelFunc
}
type Client interface {
@andrewloux
andrewloux / numa.md
Last active May 3, 2024 19:16
What is NUMA, and why should Kubernetes users care?

Historically, all memory on x86 architectures were equally accessibly by all CPUs on the system. This is an effective implementation, but there's increased bandwidth on the bus, and the more CPUs you have, the further away from the memory it is. This layout is called Uniform Memory Access.

Older UMA Layout

Modern x86 architectures introuduce the concept of memory nodes (also referred to elsewhere as zones or cells), where new writes are associated with a CPU's memory node. The nodes are connected by a bus, so all the memory is still accessible via any CPU, but of course, we have faster memory access time for CPUs accessing local nodes.

NUMA NUMA Layout

When you have a virtualization layer on top, and you are scheduling workloads, you can take advantage of this by pinning processes to specific CPUs.

@andrewloux
andrewloux / consuming-from-multiple-topics.md
Last active December 10, 2022 21:18
Kafka: Notes on Consuming from Multiple Topics

How are partitions assigned in a consumer group?

This is based on the partition assignment strategy configuration, an important note here is that this is a topic-specific configuration. It can only be used to describe the strategy used to assign partitions to a specific consumer group.

The default strategy is called the RangeAssignor strategy. In this strategy, we divide the number of partitions over the number of consumer instances, and assign one by one. If the division does not result in a nice round number, the first few consumer instances are assigned more partitions.

Example

Suppose there are two consumers C0 and C1, two topics t0 and t1, and each topic has 3 partitions, resulting in the following partitions: t0p0, t0p1, t0p2, t1p0, t1p1, and t1p2

@andrewloux
andrewloux / Makefile
Created May 27, 2018 19:41 — forked from brenns10/Makefile
Linux Character Device Example
obj-m += chardev.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
@andrewloux
andrewloux / jordon.md
Last active January 8, 2017 00:48
jordon.md

Waterloo Computer Science

  • AF: 78
  • C+V: 85
  • Eng: 85
  • Random Elective: 90
  • CompSci: 85
  • Religion: 95

Current Timetable

  • C+V
# 238 R: 13.285000 usecs RT: 12440791.662667 usecs
Digraph G {
6359376964500652.6359376964501320 [label="A"]
6359376964500652.6359376964518840 [label="B"]
6359376964500652.6359376964541175 [label="C"]
6359376964500652.6359376964501320 -> 6359376964500652.6359376964518840 [label="R: 5.840000 us"]
6359376964500652.6359376964518840 -> 6359376964500652.6359376964541175 [label="R: 7.445000 us"]
}
@andrewloux
andrewloux / thing.dot
Created March 16, 2016 18:47
regex halp
# 238 R: 13.285000 usecs RT: 12440791.662667 usecs
Digraph G {
6359376964500652.6359376964501320 [label="e10__t3__NFS3_WRITE_CALL_TYPE\nDEFAULT"]
6359376964500652.6359376964518840 [label="e10__t3__NFS_CACHE_BLOCK_OP_TYPE\nNFSCACHE_WRITE"]
6359376964500652.6359376964541175 [label="e10__t3__NFS3_WRITE_REPLY_TYPE\nDEFAULT"]
6359376964500652.6359376964501320 -> 6359376964500652.6359376964518840 [label="R: 5.840000 us"]
6359376964500652.6359376964518840 -> 6359376964500652.6359376964541175 [label="R: 7.445000 us"]
}