Skip to content

Instantly share code, notes, and snippets.

View mikedillion's full-sized avatar
🔨
If you hear any noise it's just me and my team boppin

Mike Dillion mikedillion

🔨
If you hear any noise it's just me and my team boppin
View GitHub Profile

I've been working with Apache Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥

Get the tools

@decatur
decatur / dataclass_sample.py
Created September 21, 2018 11:09
Use Python dataclass to autogenerate timestamp and sequence id on an object.
from dataclasses import dataclass, field
from itertools import count
from datetime import datetime
counter = count()
@dataclass
class Event:
message: str
@xsot
xsot / instructions.md
Last active March 3, 2024 13:42
sed maze solver

Usage

sed -E -f solver.sed input where input is a file containing the maze.

For best results, resize your terminal to match the height of the maze. To disable animations, delete the lines containing p.

Maze format

The solver assumes the following:

  • The maze only contains the characters # \nSE
  • Every line has the same number of characters
  • There is only one start (S) and end (E)
@rootkea
rootkea / spectre.c
Created January 4, 2018 15:36
PoC from Spectre Attacks: Exploiting Speculative Execution (https://spectreattack.com/spectre.pdf)
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@simonw
simonw / recover_source_code.md
Last active January 16, 2024 08:13
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@gabrielflorit
gabrielflorit / Makefile
Last active May 15, 2019 17:50
Equidistant map perimeter circles
all:
rm boundary.topojson;
mapshaper -i ~/Downloads/cb_2015_us_nation_5m/cb_2015_us_nation_5m.shp name=boundary -clip bbox=-126,23,-65,50 -filter-slivers min-area=700000000 -lines -simplify dp 5% -o format=topojson boundary.topojson;
@patilarpith
patilarpith / Solution.scala
Last active February 18, 2020 20:17
Custom checker in scala
// Start of HEAD
import org.json.simple.JSONArray
import org.json.simple.JSONObject
import org.json.simple.parser.JSONParser
import collection.JavaConversions._
// End of HEAD
// Start of Body
/**
@ericclemmons
ericclemmons / example.md
Last active February 22, 2024 16:18
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@cheshire137
cheshire137 / git-line-history.sh
Last active June 24, 2016 16:30
Find all the Git commits that modified a particular line in a file.
#!/bin/bash
# Sample use:
# PATTERN="\"/some-route\"" FILE=config/routes.rb ~/bin/git-line-history.sh
# Thanks to mikedillion <https://github.com/mikedillion> for the basis of this!
set -e
#PATTERN="version':"
#FILE="setup.py"
@eeeschwartz
eeeschwartz / index.html
Last active August 26, 2016 15:06
Esri-leaflet example: lexington council district 1
<!DOCTYPE html>
<html>
<head>
<!-- Load Leaflet from CDN-->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<!-- Load Esri Leaflet from CDN -->
<script src="http://cdn.jsdelivr.net/leaflet.esri/1.0.0/esri-leaflet.js"></script>