Skip to content

Instantly share code, notes, and snippets.

View trapier's full-sized avatar

Trapier Marshall trapier

  • Raleigh, NC USA
View GitHub Profile
@trapier
trapier / extract_initramfs.sh
Last active April 15, 2016 19:51
extract xzipped initramfs from uboot new FIT image format (itb)
#!/bin/bash
XZMAGIC=fd377a58
STRUCT_POINTER_OFFSET=8
file=$1
declare -A word
map_word () {
word[addr]=$1
@trapier
trapier / fetch_grub.yml
Created September 15, 2015 16:55
fetch grub config from ly8 switches in ansible inventory
---
- hosts: swdut
vars:
platform_search: ly8
tasks:
- name: fetch grub config
fetch: src=/etc/default/grub dest=.
when: ansible_product_name | search(".*ly8.*") or
ansible_cmdline.cl_platform | default(omit) | search(".*ly8.*")
@trapier
trapier / kernel-source-build-recipe.bash
Created August 17, 2015 21:27
bash script to build CumulusLinux 1.5.2 kernel
#!/bin/bash
# prepare extraction directory, get and extract debian sources
mkdir cumulus
cd cumulus
wget http://oss.cumulusnetworks.com/CumulusLinux-1.5.2.tar.gz
tar xvf CumulusLinux-1.5.2.tar.gz
# examine installation instructions
cat patches/README
@trapier
trapier / dons.sh
Created June 18, 2015 17:07
follow an interface with an ip address into its own namespace
#!/bin/bash
ns_name=$1
iface=$2
addr=$3
ip netns add ${ns_name}
ip a flush ${iface}
ip l s ${iface} down
ip l s ${iface} netns ${ns_name}
ip netns exec ${ns_name} /bin/bash -c "ip addr add ${addr} dev ${iface}"
ip netns exec ${ns_name} /bin/bash -c "ip l s ${iface} up"