Skip to content

Instantly share code, notes, and snippets.

View dpavlin's full-sized avatar

Dobrica Pavlinušić dpavlin

View GitHub Profile
@dpavlin
dpavlin / dell-duplicate-mac.txt
Last active August 6, 2022 05:06
How it this even possible? Same MAC on two Dell switches
dpavlin@black:~/dell-switch$ git -C snmpbulkwalk/ grep 0:11:43:9a:5b:88 | grep ifPhysAddress
sw-aula:IF-MIB::ifPhysAddress[25] = STRING: 0:11:43:9a:5b:88
sw-aula:IF-MIB::ifPhysAddress[26] = STRING: 0:11:43:9a:5b:88
sw-aula:IF-MIB::ifPhysAddress[27] = STRING: 0:11:43:9a:5b:88
sw-aula:IF-MIB::ifPhysAddress[28] = STRING: 0:11:43:9a:5b:88
sw-aula:IF-MIB::ifPhysAddress[29] = STRING: 0:11:43:9a:5b:88
sw-aula:IF-MIB::ifPhysAddress[30] = STRING: 0:11:43:9a:5b:88
sw-aula:IF-MIB::ifPhysAddress[31] = STRING: 0:11:43:9a:5b:88
sw-aula:IF-MIB::ifPhysAddress[32] = STRING: 0:11:43:9a:5b:88
sw-aula:IF-MIB::ifPhysAddress[100000] = STRING: 0:11:43:9a:5b:88
@dpavlin
dpavlin / influx-drop-shard.sh
Created April 10, 2022 14:02
drop oldest influxdb shards when disk space becomes too small
#!/bin/sh -e
free=`df -k /var/lib/influxdb/ | grep / | awk '{ print $4 }'`
test "$free" -gt 2097152 && exit 0
df -h /var/lib/influxdb
influx -database telegraf -execute 'show shards' | grep telegraf | head -2 | tee /dev/stderr | awk '{ print $1 }' | tail -1 | xargs -i influx -database telegraf -execute 'drop shard {}'
df -h /var/lib/influxdb
@dpavlin
dpavlin / sort-ip.pl
Created February 27, 2022 14:33
sort text output with ip addresses
#!/usr/bin/perl
use warnings;
use strict;
use Socket qw( inet_aton );
use Getopt::Long;
my $col = 1;
my $del = '\s+';
@dpavlin
dpavlin / git.sh
Created April 18, 2020 13:57
do same thing to multiple git repos
#!/bin/sh -e
ls -d */.git | cut -d/ -f1 | while read dir ; do
cd $dir
echo "# cd" `pwd`
git $*
cd ..
done
@dpavlin
dpavlin / saxonsoc-i2c-gpio.diff
Created January 2, 2020 11:12
SaxonSoc GPIO I2C work-in-progress
# cd /klin/FPGA/saxonsoc/buildroot
diff --git a/board/spinal/saxon_ulx3s/linux.config b/board/spinal/saxon_ulx3s/linux.config
index 4608aeeb28..940cf271f7 100644
--- a/board/spinal/saxon_ulx3s/linux.config
+++ b/board/spinal/saxon_ulx3s/linux.config
@@ -88,3 +88,13 @@ CONFIG_MTD=y
CONFIG_MTD_SPI_NOR=y
CONFIG_MTD_M25P80=y
+# debug kernel
#!/bin/sh
xclip -out | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g' | xclip -in -selection clipboard
#!/bin/sh
# workflow:
# 1. focus textarea in browser you want to edit
# 2. press ctrl+a then ctrl+c
# 3. switch to terminal and start this script with optional extensioni for highlight: xclip-vi html
# 4. edit file in vi, and save it
# 5. switch back to browser, and press ctrl+v in already selected textarea
ext=$1
@dpavlin
dpavlin / ir-tv.pl
Created November 18, 2017 08:41
Control TV using command line tool on raspberry pi
#!/usr/bin/perl
use warnings;
use strict;
use Term::ReadKey;
use Data::Dump qw(dump);
my $direction = {
A => 'UP',
B => 'DOWN',
@dpavlin
dpavlin / scan-A4.sh
Created October 14, 2016 11:33
Scan pages using Sane's scanimage and convert them to pdf (with page and pdf preview using qiv and mupdf)
#!/bin/sh -e
nr=1
mkdir $1
while true ; do
file=$1/`printf "%04d" $nr`.jpg
echo "scanning page $nr -> $file"
scanimage --progress --resolution 300 --format jpg -l 0mm -t 0mm -x 210mm -y 297mm > $file
@dpavlin
dpavlin / Makefile
Last active April 17, 2021 14:38 — forked from kost/esp8266-wifi-beacon-generator.ino
ESP8266 WiFi Beacon Generator - Generate SSID beacon frames on ESP8226
builder:
/opt/arduino-1.6.8/arduino-builder -dump-prefs -logger=machine -hardware "/opt/arduino-1.6.8/hardware" -hardware "/home/dpavlin/.arduino15/packages" -hardware "/home/dpavlin/Arduino/hardware" -tools "/opt/arduino-1.6.8/tools-builder" -tools "/opt/arduino-1.6.8/hardware/tools/avr" -tools "/home/dpavlin/.arduino15/packages" -built-in-libraries "/opt/arduino-1.6.8/libraries" -libraries "/home/dpavlin/Arduino/libraries" -fqbn=esp8266:esp8266:generic:CpuFrequency=80,FlashFreq=40,FlashMode=dio,UploadSpeed=115200,FlashSize=512K64,ResetMethod=nodemcu,Debug=Disabled,DebugLevel=None____ -ide-version=10608 -build-path "/tmp/build74183724a5572046762b09cc6849235c.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "/home/dpavlin/Arduino/esp8266_spam/esp8266_spam.ino"
/opt/arduino-1.6.8/arduino-builder -compile -logger=machine -hardware "/opt/arduino-1.6.8/hardware" -hardware "/home/dpavlin/.arduino15/packages" -hardware "/home/dpavlin/Arduino/hardware" -tools "/opt/arduino-1.6.8/tools-builder" -to