Skip to content

Instantly share code, notes, and snippets.

View bluecmd's full-sized avatar

Christian Svensson bluecmd

  • Stockholm, Sweden
View GitHub Profile
@bluecmd
bluecmd / pcap-docker.sh
Created July 31, 2022 09:54
PCAP a docker container
sudo nsenter --net=$(docker inspect --format='{{.NetworkSettings.SandboxKey}}' $(docker ps | awk '/the-container-name/ {print $1}')) tshark -i eth0 -n -w /tmp/capture.pcap
@bluecmd
bluecmd / prune-indces.py
Created July 27, 2022 10:09
Prune old indices from Elastiflow
#!/usr/bin/python3
import datetime
import re
import requests
import urllib
MAX_AGE_DAYS = 30
HOST = 'http://localhost:5601'
ir = requests.get(urllib.parse.urljoin(HOST, '/api/index_management/indices'))
@bluecmd
bluecmd / testing
Created October 5, 2021 17:46
Only allow explicit installs of packages from testing
# /etc/apt/preferences.d/testing
# Only allow explicit installs of packages from testing
Package: *
Pin: release a=testing
Pin-Priority: -10
# Allow all other packages
Package: *
Pin: release o=Debian
Pin-Priority: 800
@bluecmd
bluecmd / boot.log
Created August 31, 2021 10:28
HoneyComb LX2K Debian bookworm with 5.13 kernel
Loading Linux 5.13.0-trunk-arm64 ...
Loading initial ramdisk ...
[ 2.055188] fsl_mc_dpio dpio.15: unknown SoC version
[ 2.064490] fsl_mc_dpio dpio.14: unknown SoC version
[ 2.073471] fsl_mc_dpio dpio.13: unknown SoC version
[ 2.082147] fsl_mc_dpio dpio.12: unknown SoC version
[ 2.090918] fsl_mc_dpio dpio.11: unknown SoC version
[ 2.099422] fsl_mc_dpio dpio.10: unknown SoC version
[ 2.107945] fsl_mc_dpio dpio.9: unknown SoC version
@bluecmd
bluecmd / _etc_bash.bashrc.sh
Last active August 9, 2021 11:45
Make your Bash shell VRF aware
# System-wide .bashrc file for interactive bash(1) shells.
# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.
# --------- CUT HERE ---------
# Default to management VRF if available
[ -z "${VRF}" ] && sudo -n change-vrf "mgmt" "$$" 2>/dev/null && export VRF="mgmt"
# --------- CUT HERE ---------
@bluecmd
bluecmd / convert.sh
Last active April 5, 2023 20:05
Converting boot logo to EDK2 BMP format
# Convert a 24-bit BMP to EDK2 style BMP
# Something like 400x400 is probably the largest realistic image to use
# 300x300 looks pretty neat.
convert ~/KamelLogo.bmp -compress None -type Palette BMP3:./edk2/MdeModulePkg/Logo/Logo.bmp
@bluecmd
bluecmd / README.txt
Last active December 20, 2020 16:04
[WIP] Building OpenOCD 64-bit on Windows 10 with MSYS2 for ULX3S FTDI JTAG
# 32-bit build by me: https://github.com/bluecmd/tools/blob/master/openocd-32bit-ulx3s.zip
# This is for 64-bit
# BUG: Ends up depending on msys anyway: https://github.com/libusb/libusb/issues/829
# Note: We use MSYS for the shell to compile an MinGW64 target.
# That way the resulting binary will not rely on MSYS.
# Make sure the FTDI drivers are installed for the virtual COM port.
# As of this writing I am using "CDM v2.12.28 WHQL Certified"
@bluecmd
bluecmd / color.patch
Created October 2, 2020 11:48
Patch to make MAGIC look more according to my taste
diff -ur orig/magic-8.3.61/graphics/grTk1.c magic-8.3.61/graphics/grTk1.c
--- orig/magic-8.3.61/graphics/grTk1.c 2020-05-24 09:00:08.000000000 +0200
+++ magic-8.3.61/graphics/grTk1.c 2020-10-02 13:02:37.152809300 +0200
@@ -1441,7 +1441,7 @@
else
GrTkInstalledCMap = FALSE;
- Tcl_EvalEx(consoleinterp, "catch repaintconsole", 20, 0);
+ //Tcl_EvalEx(consoleinterp, "catch repaintconsole", 20, 0);
}
@bluecmd
bluecmd / gist:7eb4fe82013f1b93108d253152c48b2e
Created September 30, 2020 17:25
1568 SERV core count resource utilization on DE5-Net using corescorer
+----------------------------------------------------------------------------------------------------+
; Fitter Resource Usage Summary ;
+------------------------------------------------------------------+-------------------------+-------+
; Resource ; Usage ; % ;
+------------------------------------------------------------------+-------------------------+-------+
; Logic utilization (ALMs needed / total ALMs on device) ; 233,293 / 234,720 ; 99 % ;
; ALMs needed [=A-B+C] ; 233,293 ; ;
; [A] ALMs used in final placement [=a+b+c+d] ; 232,725 / 234,720 ; 99 % ;
; [a] ALMs used for LUT logic and registers ; 119,886 ; ;
; [b] ALMs used for LUT logic ; 38,783 ;
@bluecmd
bluecmd / Makefile
Last active September 7, 2020 17:10
cocotb 1.40 freeze bug with Verilator
TOPLEVEL_LANG = verilog
VERILOG_SOURCES = $(shell pwd)/test.v
TOPLEVEL = thing
MODULE = test
SIM ?= verilator
include $(shell cocotb-config --makefiles)/Makefile.sim