Skip to content

Instantly share code, notes, and snippets.

@Arie
Arie / Mellanox ConnectX 3 - 4
Last active December 20, 2023 17:44
Mellanox ConnectX 3 / 4
Updating firmware:
1. Boot Ubuntu USB stick
2. Enable universe repository (add universe after the security.ubuntu.com line in `/etc/apt/sources.list)`
3. `apt-get update && apt-get install ethtool mstflint`
4. Find PCI ID with `lspci`
5. Find PS ID of mellanox card: `mstflint -d pci-id-here q`
6. Download and unzip firmware for the correct PS ID from https://network.nvidia.com/support/firmware/firmware-downloads/
@Arie
Arie / NanoPi R6S governor
Last active July 12, 2023 18:43
NanoPi R6S governor
echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo performance > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
echo performance > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
######
echo ondemand > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
echo 10 > /sys/devices/system/cpu/cpufreq/policy0/ondemand/up_threshold
@Arie
Arie / net-smp-affinity
Last active July 12, 2023 18:43
NanoPi R6S net-smp-affinity for gigabit with layer cake SQM
#!/bin/sh
get_device_irq() {
local device="$1"
local line
local seconds="0"
# wait up to 10 seconds for the irq/device to appear
while [ "${seconds}" -le 10 ]; do
line=$(grep -m 1 "${device}\$" /proc/interrupts) && break
@Arie
Arie / NanoPi R6S core bitmask
Last active August 15, 2023 13:10
NanoPi R6S core bitmask
11111110 = fe = cores 1-7
11110000 = f0 = cores 4-7 (2.3Ghz fast)
11000000 = c0 = core 6+7
00110000 = 30 = core 4+5
11100000 = e0 = core 5+6+7
00001111 = f = cores 0-3 (1.8Ghz efficient)
00001110 = e = core 1+2+3
00001100 = c = core 2+3
@Arie
Arie / config.seed
Created October 26, 2017 13:48
config.seed ER-X LEDE
CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7621=y
CONFIG_TARGET_ramips_mt7621_DEVICE_ubnt-erx=y
# CONFIG_FEED_luci is not set
# CONFIG_FEED_packages is not set
# CONFIG_FEED_routing is not set
# CONFIG_FEED_telephony is not set
CONFIG_IMAGEOPT=y
CONFIG_LUCI_LANG_de=y
CONFIG_LUCI_LANG_en=y
CPU 0 Unable to handle kernel paging request at virtual address 00000000, epc == c016c184, r
a == 802b72c0
Oops[#1]:
CPU: 0 PID: 120 Comm: modprobe Tainted: P O 3.10.14-UBNT #2
task: 8f501b28 ti: 8f4d2000 task.ti: 8f4d2000
$ 0 : 00000000 00000065 00000002 00000000
$ 4 : 80485b40 00000001 00000000 ffffffff
$ 8 : 00000000 80219ab0 20636972 000000ac
$12 : 76207265 00000006 00000000 69737265
$16 : c0171d80 8f47e180 80485b40 8fcd6b0c
require 'csv'
last_result = `tail -n1 /usr/share/cacti/site/scripts/speedtest.csv`
def bits_to_mbit(bits)
bits / 1024.0 / 1024.0
end
CSV.parse(last_result) do |row|
@ping = row[5].to_f
/usr/local/bin/speedtest-cli --server 13379 --csv >> /usr/share/cacti/site/scripts/speedtest.csv
@Arie
Arie / gist:25b260cc02d04a67d282
Last active October 22, 2020 21:37
Installing flent on OS/X with homebrew
`pip install flent matplotlib`
`brew install fping`
Netperf in homebrew is installed without demo mode by default, so we need to edit the recipe slightly, also demo mode fails to build under OS/X, requiring a tiny patch to netlib.c ( http://www.netperf.org/pipermail/netperf-talk/2013-December/001162.html ). The following recipe changes the URL to a prepatched version that I host and changes the configure line to enable demo mode.
`brew edit netperf`
```
class Netperf < Formula
desc "Benchmarks performance of many different types of networking"

Let's go Postal!

And start using a real database

"mysql is a network-attached spreadsheet used by porn sites and other dodgy entities across the Internet." -- http://elnur.pro/avoid-mysql/