Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View wido's full-sized avatar

Wido den Hollander wido

View GitHub Profile
@wido
wido / py3-random.sh
Created October 22, 2019 05:59
Python 3 one-liner generate random string
python3 -c "import random; import string; print(''.join(random.choice(string.ascii_lowercase) for i in range(10)))"
@wido
wido / factory_mode.sh
Created October 4, 2019 09:28
Tesla MCU factory mode
#!/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 October 2, 2019 09:28
Reverse SSH tunnel
#!/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 November 2, 2023 03:23
Tesla Model S/X MCU1 eMMC image creator
#!/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 July 25, 2019 06:45
ceph-mon database re-initialize
#!/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 July 11, 2019 12:02
Qemu Guest Agent cheatsheet
#!/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 15:33
Create EVPN+VXLAN+BGP VNI on Linux
#!/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 April 20, 2019 11:01
Cumulus Linux Services in Management VRF
#!/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
#!/bin/bash
#
# Fetch the amount of shards a Ceph RADOS Gateway bucket has
#
# Author: Wido den Hollander <wido@denhollander.io>
#
BUCKET=$1
ID=$(radosgw-admin bucket stats --bucket=${BUCKET}|jq -r '.id')
@wido
wido / IPv6.java
Created January 16, 2019 10:21
Check if IPv6 Address is EUI-64 in Java
import com.googlecode.ipv6.IPv6Address;
/*
Replace the IPv6 address with anything you like, Link Local or Global, based on the 'ff:fe' in the address
this code will tell you if the address is EUI-64
Author: Wido den Hollander <wido@widodh.nl>
*/
public class IPv6 {