Skip to content

Instantly share code, notes, and snippets.

View fberndl's full-sized avatar

Florian Berndl fberndl

  • Mission Embedded GmbH
  • Vienna
View GitHub Profile
@fberndl
fberndl / gist:ecfba75989994e95b45f28252efa69f3
Created July 21, 2017 05:03 — forked from npwalker/gist:8741257
How to regenerate a puppet agent certificate
  1. On the master: puppet cert clean <agent_certname>
  2. On the agent: mv /etc/puppetlabs/puppet/ssl/ /etc/puppetlabs/puppet/ssl_bak
  • Never do this if you are trying to regenerate the cert for the agent on the master. Instead you would need to delete specific certs
  1. On the agent: puppet agent -t
  2. On the master: puppet cert sign <agent_certname>
@fberndl
fberndl / get_releases.sh
Created July 21, 2017 05:06 — forked from nikolaik/get_releases.sh
Use puppetmaster to fetch facts (JSON) from all puppet nodes without puppetdb
#!/bin/bash
NODES=`sudo puppet cert list --all|awk '{print $2}'` # Get all node names
echo '{"facts": [' > facts_tmp.json
# for node in node: get facts
echo -n $NODES | xargs -d " " -i sh -c 'sudo puppet facts find {} --terminus rest | tr "\n" "," >> facts_tmp.json'
sed -ie 's/,$//' facts_tmp.json # Remove last comma
echo ']}' >> facts_tmp.json
# optionally format and filter json (requires jq)
@fberndl
fberndl / roce-check.sh
Created August 22, 2017 11:52 — forked from hiroyuki-sato/roce-check.sh
roce-check
#!/bin/bash
echo "============================"
echo " pfcrx / pfctx parameters "
echo "============================"
for i in /sys/module/mlx?_en ; do
m=$( basename $i )
echo "INTERFACE: $m"
RTX=$( cat $i/parameters/pfcrx )
@fberndl
fberndl / _README.md
Created June 27, 2018 15:02 — forked from robinsmidsrod/_README.md
Embedded iPXE menu to choose which network adapter to boot from (autodetects up to 10 adapters)

Go into your git checkout folder of ipxe.

Save the below file as nic-menu.ipxe.

Build iPXE like this:

cd src && make EMBED=../nic-menu.ipxe && cd ..

Requirements: current iPXE as of 2013-08-01 (for proper behavior of autoboot with a network device specified, netX feature, PCI vendor/device ID display and inc command)

@fberndl
fberndl / mnt
Created September 18, 2018 10:13 — forked from embs/mnt
Mounting Linux partition
Boot your system into a live CD. Mount your system into the live CD:
sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
Log into the mounted system:
sudo chroot /mnt
@fberndl
fberndl / gist:54e5b2dd59a00aea855ba08316e04979
Created September 20, 2018 11:11 — forked from mattm7n/gist:1405067
Monitor DHCP traffic with tcpdump
# Monitoring on interface eth0
tcpdump -i eth0 -n port 67 and port 68
@fberndl
fberndl / mwan3-notes.md
Created February 10, 2020 14:21 — forked from braian87b/mwan3-notes.md
How to get MWAN3 Working Properly on OpenWRT / LEDE

In experience to get a proper working multiple wan configuration using mwan3 starting from scratch you should:

Important: this works well on OpenWRT 15.05.1, on newer versions there was some breaking changes, for example, the wan ifaces have ipv6 capability and now are named with letters ("wan, wanb... , wanc" instead of "wan, wan2... wan3" so wanb6 means 2nd wan ipv6.): https://github.com/openwrt/packages/blob/master/net/mwan3/files/etc/config/mwan3

The official documentation seems to be very detailed and up to date, I recommend reading those first: https://openwrt.org/docs/guide-user/network/wan/multiwan/mwan3 but I recommend to give a look at my config file below, since my approach for policyes is very nice.

First of all: Activate conntrack, docs says that is important and neccesary to get MWAN3 work properly, and it is needed to reboot:

@fberndl
fberndl / latancy-clock.sh
Last active March 6, 2020 13:13
gst latency-clock ( Gstreamer Latency Measurement)
# install and build
sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-0 libgstreamer1.0-dev libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio -y
https://github.com/stb-tester/latency-clock.git
cd latency-clock
make all
export GST_PLUGIN_PATH=/usr/local/lib/
# shit
sudo mv libgsttimeoverlayparse.so /usr/local/lib/
@fberndl
fberndl / sar.md
Last active March 4, 2020 10:45
sar (once per second )

sudo apt-get install sysstat -y

OS ubuntu 19.10

FILE: /etc/cron.d/sysstat

# The first element of the path is a directory where the debian-sa1
# script is located
PATH=/usr/lib/sysstat:/usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin

# Activity reports every 10 minutes everyday
@fberndl
fberndl / gen-efi-image.sh
Created October 27, 2020 15:46 — forked from oofnikj/gen-efi-image.sh
Generate OpenWrt 19.07.2 EFI-compatible image
#!/usr/bin/env bash
### UPDATED SCRIPT AVAILABLE AT https://github.com/oofnikj/openwrt-efi-tools ###
# gen-efi-image.sh [DEST_IMG] [EFI_IMG] [SOURCE_IMG]
#
# Generates an EFI-compatible x86-64 disk image for OpenWrt
# by combining the rootfs and kernel from the latest stable release
# with the EFI image available in snapshot since @a6b7c3e.
#