Skip to content

Instantly share code, notes, and snippets.

@hslabbert
hslabbert / yeet
Created July 27, 2022 04:22
yeet a git repo and reclone
#!/bin/sh
cd $1
URL=$(git remote get-url origin)
cd ..
rm -Rf $1
git clone "${URL}"
@hslabbert
hslabbert / git_merge_example.txt
Created September 30, 2020 17:18
git merge example
# set up non-conflicting changes in different branches
hslabbert@penguin:~/repos/git-example$ git branch
feature/edit1
feature/edit1_no_conflict
* master
hslabbert@penguin:~/repos/git-example$ git checkout feature/edit1
Switched to branch 'feature/edit1'
hslabbert@penguin:~/repos/git-example$ git diff HEAD~1
@hslabbert
hslabbert / pdns-via-requests.py
Last active April 10, 2020 23:09
Add/update a PowerDNS A record via requests
import json
import logging
def format_dns_rrset(
record_name,
record_values,
domain=DEFAULT_DOMAIN,
operation="REPLACE",
ttl=86400,
@hslabbert
hslabbert / record-shape-demo.dot
Created February 23, 2018 17:56
GraphViz record shape demo
graph "Record Shape demo" {
graph [ranksep=3.84 splines=line]
node [shape=record]
leaf1 [label="{{ <Port31> Port31 | <Port32> Port32 | <Port33> Port33 | <Port34> Port34 | <Port35> Port35 | <Port36> Port36 } | leaf1 | { <Port19> Port19 | <Port20> Port20 }}"]
leaf2 [label="{{ <Port31> Port31 | <Port32> Port32 | <Port33> Port33 | <Port34> Port34 | <Port35> Port35 | <Port36> Port36 } | leaf2 | { <Port19> Port19 | <Port20> Port20 }}"]
spine1 [label="{{ <Port19> Port19 | <Port20> Port20 | <Port21> Port21 | <Port22> Port22 | <Port23> Port23 | <Port24> Port24 | <Port25> Port25 | <Port26> Port26 | <Port27> Port27 | <Port28> Port28 | <Port29> Port29 | <Port30> Port30 | <Port31> Port31 | <Port32> Port32 | <Port33> Port33 | <Port34> Port34 | <Port35> Port35 | <Port36> Port36 } | spine1 | { <Port1> Port1 | <Port2> Port2 | <Port3> Port3 | <Port4> Port4 | <Port5> Port5 | <Port6> Port6 | <Port7> Port7 | <Port8> Port8 | <Port9> Port9 | <Port10> Port10 | <Port11> Port11 | <Port12> Port12 | <Port13> Port13 | <Port14> Po
@hslabbert
hslabbert / detoxize
Created March 16, 2017 23:33
Split `tox -l` output into combined tox runs with coverage test split out for combined coverage
#!/usr/bin/env python3
"""
Credit to https://hynek.me/articles/testing-packaging/
"""
import sys
if __name__ == "__main__":
envs = [env.strip() for env in sys.stdin.readlines()]
@hslabbert
hslabbert / 5-stage-clos-port-level.svg
Created February 7, 2017 04:44
Large 5-stage Clos network with port-level detail and better edge setup
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hslabbert
hslabbert / large-5-stage-clos.svg
Created January 25, 2017 21:28
Large 5-Stage Clos Network
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This be a restricted node!
You best have permission from da admins or we be coming for ya.
Protect ya neck and respect this deck.
Reloads will not he tolerated and will be punishable by RZA's Iron Fists
$$$$$$$$$$$$$$$$""$o$o$o$o$n$oo$$""$$$$$$$$$$$$$$$
$$$$$$$$$$$$""o$$$$$$$$$$"$"$$$$$$$o$"$$$$$$$$$$$$
$$$$$$$$$"$o$$$$""$oo $ "" """$$$oo"$$$$$$$$$
$$$$$$$"o$$$$" ""o $oo o o ""$$$o"$$$$$$$
$$$$$"o$$$” oo$$$$$$$$$$o "$$$o"$$$$$
$$$$"o$$$ $ o$$$$$$$$$$$$$$"$$oo "$$$ $$$$
set nocp
set textwidth=79
set tabstop=4
set shiftwidth=4
set expandtab
@hslabbert
hslabbert / docs.projectcalico.org.dns.txt
Created May 13, 2016 18:30
docs.projectcalico.org mia
$ host docs.projectcalico.org
Host docs.projectcalico.org not found: 3(NXDOMAIN)
$ dig docs.projectcalico.org
; <<>> DiG 9.10.3-P4-Debian <<>> docs.projectcalico.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 48332
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1