Skip to content

Instantly share code, notes, and snippets.

View janjagusch's full-sized avatar

Jan-Benedikt Jagusch janjagusch

View GitHub Profile
@janjagusch
janjagusch / fold-folded-stacks.py
Last active March 13, 2021 13:20
Takes a [folded stack samples file](https://github.com/brendangregg/FlameGraph#2-fold-stacks) and a regex pattern to to filter for specific stack frames and folds them again. This is useful when you want to profile a program that runs on multiple processes and want to aggregate stack frames regardless on which process they ran on.
import re
from collections import namedtuple
import click
OCCURENCES_PATTERN = re.compile(r"\d+$")
FoldedStack = namedtuple("FolderStack", ("stack", "occurences"))
@janjagusch
janjagusch / drive_mode_test.py
Created January 4, 2021 08:51
Adafruit CircuitPython CCS811 Drive Mode Test
"""
https://github.com/adafruit/Adafruit_CircuitPython_CCS811/issues/43
"""
import time
import board
import busio
import adafruit_ccs811
i2c = busio.I2C(board.SCL, board.SDA)
@janjagusch
janjagusch / replay.html
Last active April 23, 2020 13:11
Halite ship collision replay. You can see a collision at step 19 between ship 5-1 moving east and ship 10-1 moving north to position 63. The ships are yellow. The collision happends in the top-left corner.
<!--
Copyright 2020 Kaggle Inc
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software