Skip to content

Instantly share code, notes, and snippets.

Wido den Hollander wido

Block or report user

Report or block wido

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wido
wido / ip6-eui64-address.py
Created Nov 13, 2019
Calculate RFC482 (SLAAC) IPv6 address a host will obtain
View ip6-eui64-address.py
#!/usr/bin/env python3
#
# Calculate the IPv6 address a host will obtain per RFC4862
#
# Usage: ./ip6-eui64-address.py --prefix 2001:db8::/64 52:54:00:59:c2:b3
#
# Author: Wido den Hollander <wido@denhollander.io>
#
import argparse
import ipaddress
@wido
wido / ceph-failed-osd-start.sh
Created Nov 11, 2019
Start all failed Ceph OSDs
View ceph-failed-osd-start.sh
#!/bin/sh
#
# Start all OSDs on a host which didnt start for some reason
#
# Author: Wido den Hollander <wido@denhollander.io>
#
df -h|grep ceph|grep osd|awk '{print $6}'|cut -d '-' -f 2|sort -n|xargs -n 1 -I OSD systemctl reset-failed ceph-osd@OSD
df -h|grep ceph|grep osd|awk '{print $6}'|cut -d '-' -f 2|sort -n|xargs -n 1 -I OSD systemctl start ceph-osd@OSD
@wido
wido / py3-random.sh
Created Oct 22, 2019
Python 3 one-liner generate random string
View py3-random.sh
python3 -c "import random; import string; print(''.join(random.choice(string.ascii_lowercase) for i in range(10)))"
@wido
wido / factory_mode.sh
Created Oct 4, 2019
Tesla MCU factory mode
View factory_mode.sh
#!/bin/bash
#
# Put Tesla MCU1 in factory mode
#
# Call over diagnostics port with seceth enabled
#
# Reboot MCU afterwards
#
VALUE=true
@wido
wido / reverse-ssh.sh
Created Oct 2, 2019
Reverse SSH tunnel
View reverse-ssh.sh
#!/bin/bash
## To use: `ssh -p 33333 <name>@localhost` from server
server="tesla@tesla.myserver.com"
port=$(cut -c 13-17 < /var/etc/vin)
localHost="localhost"
if [ "$server" == "tesla@yourserver.com" ]; then
echo "Script not yet setup, quitting"
@wido
wido / mkteslaemmcimg.sh
Last active Nov 11, 2019
Tesla Model S/X MCU1 eMMC image creator
View mkteslaemmcimg.sh
#!/bin/bash
#
# Create a 8GB eMMC image for Tesla Model S/X MCU1
#
# Example usage: ./mkteslaemmcimg.sh ./vinXXXXX.img ./develop-2019.20.2.1-16-5659e07dfd.img
#
set -e
FIRMWARE=$2
IMAGE=$1
@wido
wido / ceph-mon-reinstall.sh
Last active Jul 25, 2019
ceph-mon database re-initialize
View ceph-mon-reinstall.sh
#!/bin/bash
set -e
#
# Re-install and re-initialize ceph-mon database
#
# Useful to go from LevelDB to RocksDB kv_backend
#
# LevelDB was the old backend used up until Jewel and
# newer versions use RocksDB
@wido
wido / qemu-ga.sh
Created Jul 11, 2019
Qemu Guest Agent cheatsheet
View qemu-ga.sh
#!/bin/bash
#
# Talk to a Virtual Machine through the Qemu Guest Agent
#
# See:
# - https://wiki.qemu.org/Features/GuestAgent
# - https://wiki.libvirt.org/page/Qemu_guest_agent
#
# Author: Wido den Hollander <wido@denhollander.io>
#
@wido
wido / create-vxlan-vni.sh
Created May 6, 2019
Create EVPN+VXLAN+BGP VNI on Linux
View create-vxlan-vni.sh
#!/bin/bash
#
# Author: Wido den Hollander <wido@denhollander.io>
#
# Also see: https://vincent.bernat.ch/en/blog/2017-vxlan-bgp-evpn
VNI=100
LOCAL=10.255.255.5
ip link add vxlan${VNI} type vxlan id ${VNI} dstport 4789 local ${LOCAL} nolearning
@wido
wido / mgmt-vrf.sh
Last active Apr 20, 2019
Cumulus Linux Services in Management VRF
View mgmt-vrf.sh
#!/bin/bash
#
# Configure the Management services in Cumulus Linux to only run in the management VRF
#
# Author: Wido den Hollander <wido@denhollander.io>
#
# https://docs.cumulusnetworks.com/display/DOCS/Management+VRF
for SERVICE in ssh ntp snmpd; do
systemctl stop ${SERVICE}.service
You can’t perform that action at this time.