scraps
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| scraps [2022/10/18 18:58] – created - external edit 127.0.0.1 | scraps [2025/07/14 13:07] (current) – [Image and Compress Disk] millerjs | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Scraps ====== | ====== Scraps ====== | ||
| + | |||
| Bits and pieces I want to be able to grab quickly. This page will change frequently. | Bits and pieces I want to be able to grab quickly. This page will change frequently. | ||
| + | ===== GNSS Related ===== | ||
| + | ==== PowerRename bulk NRCAN-PPP Results ==== | ||
| + | Rename '' | ||
| + | |||
| + | |||
| + | Regular Expression: '' | ||
| + | Replace with: '' | ||
| + | |||
| + | {{:: | ||
| + | ===== Anydesk Debian Setup ===== | ||
| + | 1) Confirm X (not wayland!) | ||
| + | |||
| + | - Run '' | ||
| + | |||
| + | - Check the session types: '' | ||
| + | |||
| + | 2) Add anydesk deb repository: https:// | ||
| + | < | ||
| + | # Add the AnyDesk GPG key | ||
| + | sudo apt update | ||
| + | sudo apt install ca-certificates curl apt-transport-https | ||
| + | sudo install -m 0755 -d / | ||
| + | sudo curl -fsSL https:// | ||
| + | sudo chmod a+r / | ||
| + | |||
| + | # Add the AnyDesk apt repository | ||
| + | echo "deb [signed-by=/ | ||
| + | |||
| + | # Update apt caches and install the AnyDesk client | ||
| + | sudo apt update | ||
| + | sudo apt install anydesk | ||
| + | </ | ||
| + | |||
| + | 3) set password for unattended access: '' | ||
| + | |||
| + | 4) Get ID: '' | ||
| + | |||
| + | https:// | ||
| ===== Disable power button shutdown ===== | ===== Disable power button shutdown ===== | ||
| + | |||
| edit / | edit / | ||
| uncomment HandPowerKey, | uncomment HandPowerKey, | ||
| + | ===== Get & Set date w/ epoch time ===== | ||
| + | |||
| + | Get from good machine: | ||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | Set on another: | ||
| + | < | ||
| + | ===== Image and Compress Disk ===== | ||
| + | < | ||
| + | dd if=/dev/sda bs=100M | pv -ptera -s500G | lz4 > backup-name.dd.lz4 | ||
| + | </ | ||
| + | (-s500G refers to the image size, for estimates) | ||
| + | |||
| + | Mount the whole disk image: (have to un-lz4 first ofc) | ||
| + | |||
| + | < | ||
| + | kpartx -a -v myimage.disk | ||
| + | |||
| + | mount / | ||
| + | </ | ||
| + | |||
| + | Then, to unmount: | ||
| + | |||
| + | < | ||
| + | umount / | ||
| + | |||
| + | kpartx -d -v myimage.disk | ||
| + | </ | ||
| + | |||
| + | Decompress and write back to a drive: | ||
| + | < | ||
| + | unlz4 < backup-name.dd.lz4 | dd bs=100M of=/dev/sda status=progress oflag=dsync ; sync | ||
| + | </ | ||
| ===== ntplogtemp ===== | ===== ntplogtemp ===== | ||
| + | |||
| < | < | ||
| #!/bin/bash | #!/bin/bash | ||
| Line 15: | Line 91: | ||
| sed -i ' | sed -i ' | ||
| sed -i ' | sed -i ' | ||
| + | |||
| </ | </ | ||
| - | ===== Quick Pi ID ===== | + | ===== cycle systemd logs ===== |
| + | < | ||
| + | |||
| + | ==== show systemd logs from boot ==== | ||
| + | < | ||
| + | |||
| + | ===== Raspberry Pi ===== | ||
| + | ==== Quick Pi ID ==== | ||
| Easy way to get a quick visual indicator to ID a Pi you're remoted into: | Easy way to get a quick visual indicator to ID a Pi you're remoted into: | ||
| Blink pwr LED at 1Hz: | Blink pwr LED at 1Hz: | ||
| - | < | + | |
| + | < | ||
| + | echo timer | sudo tee / | ||
| + | |||
| + | </ | ||
| Set pwr LED back to monitor voltage: | Set pwr LED back to monitor voltage: | ||
| - | <code> | + | < |
| + | echo input | sudo tee / | ||
| - | ===== Raspberry Pi Heartbeat | + | </ |
| + | |||
| + | ==== Heartbeat | ||
| set in config.txt | set in config.txt | ||
| - | < | + | |
| + | < | ||
| dtparam=act_led_trigger=heartbeat | dtparam=act_led_trigger=heartbeat | ||
| + | |||
| </ | </ | ||
| + | ==== Grow partition on first boot ==== | ||
| + | Add to the end of / | ||
| + | < | ||
| + | quiet init=/ | ||
| + | </ | ||
| ===== chronyc tracking ===== | ===== chronyc tracking ===== | ||
| + | |||
| -m flag combines commands. For example: sources -v, tracking, sourcestats -v | -m flag combines commands. For example: sources -v, tracking, sourcestats -v | ||
| < | < | ||
| + | |||
| chronyc -m ' | chronyc -m ' | ||
| + | |||
| </ | </ | ||
| ===== DHCP and Static IP on the same interface ===== | ===== DHCP and Static IP on the same interface ===== | ||
| + | |||
| Ubuntu Server 20.04, should apply to netplan in general. | Ubuntu Server 20.04, should apply to netplan in general. | ||
| Line 57: | Line 160: | ||
| addresses: | addresses: | ||
| - 172.16.0.2 | - 172.16.0.2 | ||
| + | |||
| </ | </ | ||
| ===== Find files under certain size and move them ===== | ===== Find files under certain size and move them ===== | ||
| + | |||
| < | < | ||
| find . -type f -size -150M -exec mv {} ../junk \; | find . -type f -size -150M -exec mv {} ../junk \; | ||
| + | |||
| </ | </ | ||
| - | |||
| ===== nmap testers ===== | ===== nmap testers ===== | ||
| + | |||
| NTP | NTP | ||
| + | |||
| < | < | ||
| sudo nmap -sU -p 123 --script ntp-info 172.16.1.6 | sudo nmap -sU -p 123 --script ntp-info 172.16.1.6 | ||
| + | |||
| </ | </ | ||
| DHCP | DHCP | ||
| + | |||
| < | < | ||
| sudo nmap -sU -p 67 --script=dhcp-discover 172.16.0.2 | sudo nmap -sU -p 67 --script=dhcp-discover 172.16.0.2 | ||
| + | |||
| </ | </ | ||
| + | |||
| ===== Standalone certbot DNS ===== | ===== Standalone certbot DNS ===== | ||
| + | |||
| < | < | ||
| - | sudo certbot certonly --manual --preferred-challenges dns -d webgis.syninf.net</ | + | sudo certbot certonly --manual --preferred-challenges dns -d webgis.syninf.net |
| + | |||
| + | </ | ||
| ===== rsync incremental copy ===== | ===== rsync incremental copy ===== | ||
| - | https:// | + | |
| + | [[https:// | ||
| < | < | ||
| + | |||
| sudo rsync -avuP / | sudo rsync -avuP / | ||
| + | |||
| </ | </ | ||
| ===== Add NTP Server to PiHole DHCP ===== | ===== Add NTP Server to PiHole DHCP ===== | ||
| + | |||
| < | < | ||
| echo ' | echo ' | ||
| + | |||
| </ | </ | ||
| Restart pihole | Restart pihole | ||
| < | < | ||
| + | |||
| sudo service pihole-FTL reload | sudo service pihole-FTL reload | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== Build LinuxPTP on Alpine ===== | ||
| + | Enable community repository | ||
| + | |||
| + | install deps | ||
| + | < | ||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | |||
| + | ===== Cycle Chrony Logs ===== | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | # chrony log rotation | ||
| + | |||
| + | cd / | ||
| + | |||
| + | mv measurements.log measurements.$(date +" | ||
| + | mv statistics.log statistics.$(date +" | ||
| + | mv tracking.log tracking.$(date +" | ||
| + | |||
| + | sync | ||
| + | |||
| + | chronyc cyclelogs | ||
| + | </ | ||
| + | |||
| + | ===== chrony.conf ptp as pps refclock ===== | ||
| + | < | ||
| + | server time-a.nist.gov | ||
| + | server time-a-wwv.nist.gov | ||
| + | |||
| + | refclock SHM 0 poll 3 refid GPS | ||
| + | refclock PHC / | ||
| + | |||
| + | logdir / | ||
| + | log statistics tracking measurements | ||
| + | |||
| + | driftfile / | ||
| + | |||
| + | dumpdir / | ||
| + | |||
| + | rtcsync | ||
| + | |||
| + | allow | ||
| + | cmdallow | ||
| + | </ | ||
| + | |||
| + | ===== Set NIC to promiscuous mode at boot ===== | ||
| + | Using systemd: | ||
| + | |||
| + | `/ | ||
| + | |||
| + | < | ||
| + | [Unit] | ||
| + | Description=Control promiscuous mode for interface eth0 | ||
| + | After=network.target | ||
| + | |||
| + | [Service] | ||
| + | Type=oneshot | ||
| + | ExecStart=/ | ||
| + | ExecStop=/ | ||
| + | RemainAfterExit=yes | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | </ | ||
| + | |||
| + | ===== Proxmox ===== | ||
| + | ==== re-number VM ==== | ||
| + | |||
| + | 1) shut down VM | ||
| + | 2) rename the storage | ||
| + | < | ||
| + | 3) rename the configuration file | ||
| + | < | ||
| + | export vgNAME=vg-images newVMID=173 oldVMID=175 ; \ | ||
| + | sed -i " | ||
| + | unset vgNAME newVMID oldVMID; | ||
| </ | </ | ||
scraps.1666119538.txt.gz · Last modified: (external edit)
