add syntax highlight

tengel 2024-09-05 07:43:21 -05:00
parent 943c6f9911
commit 44c1e6c8ee
12 changed files with 27 additions and 26 deletions

@ -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 (= )

@ -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

@ -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}"

@ -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 @@

@ -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

@ -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

@ -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
```

@ -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 ]] || {

@ -1,6 +1,6 @@
CSS block to force a reset of all elements
```
```css
.reset-this {
animation : none;
animation-delay : 0;

@ -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
#

@ -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
```

@ -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)