From 44c1e6c8ee0e77afdf5590981b0591412190994a Mon Sep 17 00:00:00 2001 From: tengel Date: Thu, 5 Sep 2024 07:43:21 -0500 Subject: [PATCH] add syntax highlight --- APT-WhatProvides.md | 4 ++-- Apache-wpadmin.md | 2 +- Arch-Default-Kernel.md | 2 +- Arch-Kernel-Order.md | 2 +- Bash-Add-fd.md | 2 +- Bash-Dump-History.md | 2 +- Bash-Trim-Whitespace.md | 8 ++++---- CPU-Stats.md | 4 ++-- CSS-Reset.md | 2 +- DB2-Info.md | 5 +++-- Debian-Upgrade.md | 16 ++++++++-------- Diff-Lines.md | 4 ++-- 12 files changed, 27 insertions(+), 26 deletions(-) diff --git a/APT-WhatProvides.md b/APT-WhatProvides.md index a4f9103..5f7ef2c 100644 --- a/APT-WhatProvides.md +++ b/APT-WhatProvides.md @@ -1,6 +1,6 @@ APT whatprovides -``` +```bash #!/bin/sh # list packages providing a target @@ -9,7 +9,7 @@ WHAT="$1"; \ apt-cache showpkg "${WHAT}" | sed '/Reverse Provides/,$!d' ## ./apt-whatprovides.sh php-fpm -# Reverse Provides: +# Reverse Provides: # php8.0-fpm 8.0.0-1+ubuntu20.04.1+deb.sury.org+1 (= ) # php7.4-fpm 7.4.13-1+ubuntu20.04.1+deb.sury.org+1 (= ) # php7.3-fpm 7.3.25-1+ubuntu20.04.1+deb.sury.org+1 (= ) diff --git a/Apache-wpadmin.md b/Apache-wpadmin.md index 0f9a831..d36afcf 100644 --- a/Apache-wpadmin.md +++ b/Apache-wpadmin.md @@ -2,7 +2,7 @@ When using multiple webservers in a load balancer, it's common that one node wil Using a simple Apache reverse proxy on all the nodes _except_ the admin node can be handy, for instance in a Wordpress setup. -``` +```apacheconf # 192.168.3.3 = admin node private IP ProxyRequests Off ProxyPreserveHost Off diff --git a/Arch-Default-Kernel.md b/Arch-Default-Kernel.md index 548925e..92fb08b 100644 --- a/Arch-Default-Kernel.md +++ b/Arch-Default-Kernel.md @@ -1,6 +1,6 @@ Set the default kernel in GRUB2 for Arch -``` +```bash ROOT_PART=$(grub-probe --target=device /) ROOT_UUID=$(grub-probe --device ${ROOT_PART} --target=fs_uuid) grub-set-default "gnulinux-linux-advanced-${ROOT_UUID}" diff --git a/Arch-Kernel-Order.md b/Arch-Kernel-Order.md index baec941..98bbfa4 100644 --- a/Arch-Kernel-Order.md +++ b/Arch-Kernel-Order.md @@ -2,7 +2,7 @@ Patch GRUB2 on Arch to sort the kernels so that the top entry is the latest stan grub2 /etc/grub.d/10_linux ordering patch (http://savannah.gnu.org/bugs/?42597) -``` +```diff --- 10_linux.orig 2014-05-14 01:22:27.000000000 -0500 +++ 10_linux 2014-06-21 13:20:37.816869963 -0500 @@ -177,7 +177,16 @@ diff --git a/Bash-Add-fd.md b/Bash-Add-fd.md index aaa90ee..c72605c 100644 --- a/Bash-Add-fd.md +++ b/Bash-Add-fd.md @@ -1,6 +1,6 @@ If you've run out of file descriptors but can manage to get to a shell without needing to open more, bash can handle the rest using built in features. -``` +```bash #!/usr/bin/env bash builtin read -r NFM < /proc/sys/fs/file-max diff --git a/Bash-Dump-History.md b/Bash-Dump-History.md index 5f68088..38387ca 100644 --- a/Bash-Dump-History.md +++ b/Bash-Dump-History.md @@ -1,6 +1,6 @@ Using `gdb` to trigger the internal bash function to write out it's history still in memory but not on disk -``` +```bash #!/usr/bin/env bash # Given the PID of an active bash process, dump it's history diff --git a/Bash-Trim-Whitespace.md b/Bash-Trim-Whitespace.md index b7d13cd..9deeec7 100644 --- a/Bash-Trim-Whitespace.md +++ b/Bash-Trim-Whitespace.md @@ -1,17 +1,17 @@ Trim whitespace in pure bash -``` +```bash # turn it on shopt -s extglob output=" This is a test " - + ### Trim leading whitespaces ### output="${output##*( )}" - + ### trim trailing whitespaces ## output="${output%%*( )}" echo "=${output}=" - + # turn it off shopt -u extglob ``` diff --git a/CPU-Stats.md b/CPU-Stats.md index 9481551..7bb0446 100644 --- a/CPU-Stats.md +++ b/CPU-Stats.md @@ -1,6 +1,6 @@ Sample the CPU for stats while testing -``` +```bash #!usr/bin/env bash DTS=$(date +"%Y%m%d") @@ -22,7 +22,7 @@ echo " bc not installed. Aborting!" >&2; exit 1; } [[ "$1" =~ ^-?[0-9]+$ ]] || { echo " Supply an interger and try again." >&2; exit 1; } -[[ -d $XDG_RUNTIME_DIR ]] && +[[ -d $XDG_RUNTIME_DIR ]] && file=$XDG_RUNTIME_DIR/"stats-$DTS" || file=/tmp/"stats-$DTS" [[ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq ]] || { diff --git a/CSS-Reset.md b/CSS-Reset.md index eb549fe..c1c673d 100644 --- a/CSS-Reset.md +++ b/CSS-Reset.md @@ -1,6 +1,6 @@ CSS block to force a reset of all elements -``` +```css .reset-this { animation : none; animation-delay : 0; diff --git a/DB2-Info.md b/DB2-Info.md index 4e40782..0f0010b 100644 --- a/DB2-Info.md +++ b/DB2-Info.md @@ -4,8 +4,9 @@ This script is RHCS friendly and LSB compliant, designed to provide proper shutd - Customize `DB2PROF` and `DB2LOG` as needed -``` -/etc/init.d/ibmdb2 +**/etc/init.d/ibmdb2** + +```bash #!/bin/sh # diff --git a/Debian-Upgrade.md b/Debian-Upgrade.md index 0bcc885..d1520ae 100644 --- a/Debian-Upgrade.md +++ b/Debian-Upgrade.md @@ -6,7 +6,7 @@ Before upgrading, upgrade and repair existing problems: -``` +```bash apt-get update apt-get upgrade apt-get full-upgrade @@ -41,7 +41,7 @@ Notes: - keep existing configs as desired - let GRUB re-install to the boot disk -``` +```bash apt-get update apt-get upgrade --without-new-pkgs apt-get full-upgrade @@ -51,7 +51,7 @@ apt-get full-upgrade Some upgrades change behaviour and need to be reverted prior to a reboot, such as this bugfix in the D11 kernel which is incompatible with the D12 kernel: -``` +```bash $ cat /etc/modprobe.d/iwlwifi.conf # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=969264 #options iwlwifi enable_ini=N @@ -61,7 +61,7 @@ This setting must be disabled prior to reboot or the `iwlwifi` module will fail ## Reboot -``` +```bash reboot ``` @@ -69,7 +69,7 @@ reboot Look for strays, "rc" tends to mean it can be purged (was to be removed, failed): -``` +```bash apt-get autoremove --purge dpkg -l | grep -v ^ii ... @@ -80,7 +80,7 @@ apt-get purge python Look for installed packages not in the repo anymore: -``` +```bash aptitude search "?installed?not(?narrow(?installed,?origin(^Debian$)?archive(^stable)))" i A cpp-10 - GNU C preprocessor @@ -101,7 +101,7 @@ i A linux-image-5.10.0-26-amd64 - Linux 5.10 for 64-bit PCs (signed) Remove the packages which are safe and their unnecessary dependencies: -``` +```bash apt-get remove --autoremove --purge cpp-10 gcc-10 gcc-10-base \ gcc-9-base libbpf0 libdns-export1110 libffi7 libgcc-10-dev \ libisc-export1105 libprocps8 libruby2.7 libsepol1 libssl1.1 \ @@ -110,7 +110,7 @@ apt-get remove --autoremove --purge cpp-10 gcc-10 gcc-10-base \ Run a quick metadata clean on apt, it should show messages about deleting old index data, packages or other legacy data. -``` +```bash apt-get autoclean ``` diff --git a/Diff-Lines.md b/Diff-Lines.md index 7cbd80e..3ff139c 100644 --- a/Diff-Lines.md +++ b/Diff-Lines.md @@ -1,6 +1,6 @@ One liner to diff lines one by one (handy for ldd output) -``` +```bash #!/bin/sh diff --unchanged-line-format="" \ @@ -16,7 +16,7 @@ diff --unchanged-line-format="" \ # ldd libsomething.so.old | sort > old.txt # ldd libsomething.so.new | sort > new.txt # -# diffl.sh old.txt new.txt +# diffl.sh old.txt new.txt # 1: /usr/lib64/ld-linux-x86-64.so.2 (0x00007f61ba4c7000) # 1: /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6b96d6b000) # 2: libc.so.6 => /usr/lib/libc.so.6 (0x00007f61b89f2000)