### Install Plann Dependencies and Package Source: https://nali.org/wiki/tech/apps/plann Installs necessary Python packages and then installs plann using its setup script. Ensure you are in a Python virtual environment before running. ```bash pip install setuptools && pip install pyinstaller && python setup.py install ``` -------------------------------- ### Install Tailscale CLI on Mac Source: https://nali.org/wiki/tech/apps/tailscale Use this command to install the latest versions of the Tailscale and Tailscaled binaries using Go. Ensure Go is installed and configured on your system. ```bash go install tailscale.com/cmd/tailscale@latest tailscale.com/cmd/tailscaled@latest ``` -------------------------------- ### Install IMAPFilter and Pass Source: https://nali.org/wiki/tech/apps/imapfilter Installs the necessary packages for IMAPFilter and password management. ```bash sudo apt-get install pass imapfilter ``` -------------------------------- ### Plann Configuration File Example Source: https://nali.org/wiki/tech/apps/plann Defines CalDAV connection details for different calendar sources. A 'default' section is mandatory. The 'all' section aggregates multiple configurations. ```yaml default: caldav_url: "https://caldav.icloud.com:443/ caldav_pass: some-domain-name: caldav_url: "https://mail.example.com/SOGo/dav/some@email.com/Calendar" caldav_user: some@email.com caldav_pass: all: contains: ['default', 'some-domain-name'] ``` -------------------------------- ### Installing Missing Libraries for NUT Source: https://nali.org/wiki/tech/apps/nut This command installs the necessary `libusb-1.0-0` and `libusb-1.0-0-dev` packages, which are required for `nut-scanner` to detect USB devices. ```bash apt -y install libusb-1.0-0 libusb-1.0-0-dev ``` -------------------------------- ### Create Ultra-Minimal Dockerfile from Scratch Source: https://nali.org/wiki/tech/devops/docker An advanced Dockerfile example using the 'scratch' base image to create an extremely minimal image by copying only necessary binaries and libraries from a base Ubuntu image. This is for highly optimized use cases. ```dockerfile FROM scratch COPY --from=ubuntu:20.04 /bin /bin COPY --from=ubuntu:20.04 /lib /lib COPY --from=ubuntu:20.04 /lib64 /lib64 COPY --from=ubuntu:20.04 /usr /usr COPY --from=ubuntu:20.04 /etc /etc COPY --from=ubuntu:20.04 /var /var ENV DEBIAN_FRONTEND=noninteractive ``` -------------------------------- ### Successful nut-scanner Output After Library Installation Source: https://nali.org/wiki/tech/apps/nut This output demonstrates the successful detection of a USB UPS device after installing the required libraries. It lists the detected device's properties, including driver, port, vendor, and product IDs. ```bash root@nuts:~# nut-scanner -U Cannot load SNMP library (libnetsnmp.so) : file not found. SNMP search disabled. Cannot load XML library (libneon.so) : file not found. XML search disabled. Cannot load AVAHI library (libavahi-client.so) : file not found. AVAHI search disabled. Cannot load IPMI library (libfreeipmi.so) : file not found. IPMI search disabled. Cannot load NUT library (libupsclient.so) : file not found. NUT search disabled. Scanning USB bus. [nutdev1] driver = "usbhid-ups" port = "auto" vendorid = "0764" productid = "0501" product = "CP1500AVRLCDa" serial = "CTHGW2006191" vendor = "CPS" bus = "002" device = "003" busport = "001" ###NOTMATCHED-YET###bcdDevice = "0200" ``` -------------------------------- ### Maubot CLI Authentication Success Source: https://nali.org/wiki/tech/apps/matrix Example output after successfully logging into the Maubot CLI. This provides the access token and device ID needed for client configuration. ```text Successfully logged in as @rssbot:. Access token: syt_.... Device ID: maubot_R... ``` -------------------------------- ### Start Docker Compose and Shell into Container Source: https://nali.org/wiki/tech/devops/docker Commands to start Docker services defined in docker-compose.yml in detached mode and then execute a bash shell inside a specific container. ```bash docker compose up -d docker exec -it minimal-ubuntu bash ``` -------------------------------- ### List Network Hardware Source: https://nali.org/wiki/tech/devops/cli Lists all network services installed on a macOS system. Use this to identify network devices for subsequent commands. ```bash sudo networksetup -listallnetworkservices ``` -------------------------------- ### Install Mautrix Telegram PIP Package Source: https://nali.org/wiki/tech/apps/matrix Install the mautrix-telegram package with all dependencies using pip. Ensure you upgrade to the latest version to avoid missing dependencies. ```bash pip install --upgrade mautrix-telegram[all] ``` -------------------------------- ### Docker Daemon Error Example Source: https://nali.org/wiki/tech/devops/lxc-lxd An example of a Docker daemon error message related to container creation, specifically an 'OCI runtime create failed' error due to issues mounting the 'proc' filesystem. This often indicates a problem with container runtime permissions or configuration. ```bash docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "proc" to rootfs at "/proc": mount proc:/proc (via /proc/self/fd/6), flags: 0xe: permission denied: unknown. ``` -------------------------------- ### Deploy Astro Application with Wrangler Source: https://nali.org/wiki/tech/devops/cli Build an Astro application and deploy it using wrangler. This command assumes wrangler is already installed and configured. ```bash npm run astro build && npx wrangler pages deploy ``` -------------------------------- ### Troubleshoot Container Init Error (Nesting) Source: https://nali.org/wiki/tech/devops/lxc-lxd Enables nesting for a container by setting the 'security.nesting' configuration option to 'true'. This is often required to resolve errors like 'runc create failed: unable to start container process' when containers need to run other containers or specific system features. ```bash lxc config set security.nesting true ``` -------------------------------- ### Docker Compose Configuration Source: https://nali.org/wiki/tech/devops/docker A docker-compose.yml file to define and run a multi-container Docker application. This example sets up a service using the 'minimal-ubuntu' image and an isolated network. ```yaml version: '3.3' services: minimal-ubuntu: image: minimal-ubuntu container_name: my_minimal_ubuntu networks: - isolated_network volumes: - ./shared:/shared stdin_open: true tty: true networks: isolated_network: external: true ``` -------------------------------- ### Initial nut-scanner Output on Minimized Ubuntu 24.04 Source: https://nali.org/wiki/tech/apps/nut This output shows the errors encountered when running `nut-scanner` on a minimized Ubuntu 24.04 installation due to missing libraries. It indicates which libraries are not found and that corresponding search options are disabled. ```bash root@nuts:~# sudo nut-scanner -U Cannot load USB library (libusb-1.0.so) : file not found. USB search disabled. Cannot load SNMP library (libnetsnmp.so) : file not found. SNMP search disabled. Cannot load XML library (libneon.so) : file not found. XML search disabled. Cannot load AVAHI library (libavahi-client.so) : file not found. AVAHI search disabled. Cannot load IPMI library (libfreeipmi.so) : file not found. IPMI search disabled. Cannot load NUT library (libupsclient.so) : file not found. NUT search disabled. nut-scanner : utility for detection of available power devices. OPTIONS: -C, --complete_scan: Scan all available devices except serial ports (default). * Options for USB devices scan not enabled: library not detected. * Options for SNMP devices scan not enabled: library not detected. * Options for XML/HTTP devices scan not enabled: library not detected. -O, --oldnut_scan: Scan NUT devices (old method). * Options for NUT devices (avahi method) scan not enabled: library not detected. * Options for IPMI devices scan not enabled: library not detected. -E, --eaton_serial : Scan serial Eaton devices (XCP, SHUT and Q1). -T, --thread : Limit the amount of scanning threads running simultaneously (default: 512). Note: many scanning options depend on further loadable libraries. Run-time loadable library search paths used by this build of NUT: NOTE: Reporting filtered (existing unique) built-in paths: Built-in: /usr/lib/x86_64-linux-gnu Built-in: /usr/lib64 Built-in: /usr/lib Built-in: /usr/local/lib . . . ``` -------------------------------- ### Persist iptables Rules Source: https://nali.org/wiki/tech/devops/docker Commands to save the current iptables configuration to a file for persistence across reboots. It also includes instructions for installing and enabling the `iptables-persistent` service. ```bash iptables-save > /etc/iptables/rules.v4 sudo apt install iptables-persistent netfilter-persistent sudo systemctl status netfilter-persistent sudo systemctl enable netfilter-persistent ``` -------------------------------- ### Get DNS Settings by Device Source: https://nali.org/wiki/tech/devops/cli Retrieves the current DNS server settings for a specified network device on macOS. Replace with the actual network service name. ```bash networksetup -getdnsservers ``` -------------------------------- ### Create Minimal Ubuntu Dockerfile Source: https://nali.org/wiki/tech/devops/docker Defines a Dockerfile for a minimal Ubuntu image, including essential packages and cleanup steps. Use this to build a lean base image for your applications. ```dockerfile FROM ubuntu:20.04 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -y --no-install-recommends \ ca-certificates \ curl \ vim \ && apt-get clean && \ rm -rf /var/lib/apt/lists/* ``` -------------------------------- ### OCI Policy Example Source: https://nali.org/wiki/tech/devops/cli An example of an OCI IAM policy statement that grants specific services access to keys within a tenancy based on a key OCID. ```plaintext Allow service blockstorage, compute to use keys in tenancy where target.key.id = 'ocid1.key.oc1.iad....' ``` -------------------------------- ### LXC/LXD Stack Creation and Deletion Script Source: https://nali.org/wiki/tech/devops/lxc-lxd This script automates the creation and deletion of LXC/LXD resources. Use --create with a prefix to set up a stack, and --delete with the same prefix to remove it. Ensure the 'ubuntu-24.04-minimal-x86_64' image is available for creation. ```bash #!/bin/bash set -e create_resources() { local prefix=$1 # Create profile echo "Creating profile: ${prefix}-profile" lxc profile create "${prefix}-profile" # Set instance options echo "Setting instance options (limits.cpu=2, limits.memory=2GB) for ${prefix}-profile" lxc profile set "${prefix}-profile" limits.cpu=2 limits.memory=2GB # Create bridged network local network_name="br-${prefix}" echo "Creating network: ${network_name}" lxc network create "${network_name}" # Add network device to profile echo "Adding network device eth0 to ${prefix}-profile" lxc profile device add "${prefix}-profile" eth0 nic nictype=bridged parent="${network_name}" # Create ZFS storage pool local storage_pool="${prefix}-pool" echo "Creating storage pool: ${storage_pool}" lxc storage create "${storage_pool}" zfs size=10GB # Add root disk device to profile echo "Adding root disk device to ${prefix}-profile" lxc profile device add "${prefix}-profile" root disk path=/ pool="${storage_pool}" # Launch container with profile local container_name="${prefix}-container" echo "Launching container: ${container_name} with profile ${prefix}-profile" lxc launch ubuntu-24.04-minimal-x86_64 "${container_name}" --profile "${prefix}-profile" # Execute post-launch commands (install packages) # echo "Executing commands in ${container_name} to install packages (telnet, iputils-ping, dnsutils, deborphan)" # lxc exec "${container_name}" -- bash -c 'apt-get update; apt-get upgrade -y; apt-get install -y telnet iputils-ping dnsutils deborphan; exit' echo "Resources created successfully." } delete_resources() { local prefix=$1 # Fetch container name local container_name="${prefix}-container" # Check if container is running and stop it if lxc list --format csv -c ns | grep "^${container_name},RUNNING"; then echo "Stopping container: ${container_name}" lxc stop "${container_name}" --force fi # Delete container echo "Deleting container: ${container_name}" lxc delete "${container_name}" || true # Continue even if deletion fails # Fetch network name local network_name="br-${prefix}" # Detach network from instances and profiles echo "Detaching network from instances and profiles: ${network_name}" lxc network detach-profile "${network_name}" "${prefix}-profile" || true # Continue even if detachment fails # Delete network echo "Deleting network: ${network_name}" lxc network delete "${network_name}" || true # Continue even if deletion fails # Fetch storage pool name local storage_pool="${prefix}-pool" # Delete storage pool echo "Deleting storage pool: ${storage_pool}" lxc storage delete "${storage_pool}" || true # Continue even if deletion fails # Delete profile echo "Deleting profile: ${prefix}-profile" lxc profile delete "${prefix}-profile" || true # Continue even if deletion fails echo "Resources with prefix ${prefix} deleted successfully." } # Main script logic if [ "$1" == "--create" ]; then create_resources "$2" elif [ "$1" == "--delete" ]; then delete_resources "$2" else echo "Usage: $0 --create|--delete " exit 1 fi ``` -------------------------------- ### Turn on Pi-hole using API Source: https://nali.org/wiki/tech/privacy This command uses `curl` to enable Pi-hole via its API. ```APIDOC ## Turn on Pi-hole using API ### Description This command uses `curl` to enable Pi-hole via its API. ### Method GET ### Endpoint `http://:/admin/api.php?enable&auth=` ### Parameters #### Query Parameters - **enable** (string) - Required - Parameter to enable Pi-hole. - **auth** (string) - Required - Your Pi-hole API authentication token. ### Request Example ```bash curl "http://:/admin/api.php?enable&auth=" ``` ### Notes - Replace `` and `` with your Pi-hole server's IP address and port. ``` -------------------------------- ### Compile Plann into a Standalone Binary Source: https://nali.org/wiki/tech/apps/plann Uses PyInstaller to create a single executable file for the plann CLI. The output binary will be located in the 'dist' directory. ```bash pyinstaller --onefile plann/cli.py ``` -------------------------------- ### View Plugin Key Mappings with Telescope Source: https://nali.org/wiki/tech/apps/neovim Use the Telescope plugin to view all defined key mappings, including plugin and user-defined ones. ```vim :Telescope keymaps ``` -------------------------------- ### Extract Calendar ID from iCloud URL Source: https://nali.org/wiki/tech/apps/plann This is an example URL format from iCloud CalDAV. The "" part is the identifier needed for configuration. ```text https://pXX-caldave.icloud.com:443//calendars... ``` -------------------------------- ### Mirror or Download Website Source: https://nali.org/wiki/tech/devops/cli Recursively download a website, including its pages and requisites. This command adjusts links, spans hosts, and restricts filenames for Windows compatibility. Use with caution as it can consume significant bandwidth and disk space. ```bash wget --recursive --page-requisites --adjust-extension \ --span-hosts --convert-links --restrict-file-names=windows \ -t 1 -T 5 -c -D --no-parent ``` -------------------------------- ### Add Telescope Frecency Plugin Source: https://nali.org/wiki/tech/apps/neovim Basic configuration template for adding the telescope-frecency.nvim plugin to Neovim using a plugin manager. ```lua return { { "nvim-telescope/telescope-frecency.nvim", config = function() require("telescope").load_extension "frecency" end, keys = { { "xtf", "Telescope frecency", "Telescope frecency", }, }, }, } ``` -------------------------------- ### Basic Caddy WebDAV Server Configuration Source: https://nali.org/wiki/tech/devops/caddy Configure Caddy to serve files from a directory with basic authentication and directory browsing enabled. Use 'caddy hash-password' to generate hashed passwords. ```caddyfile example.com { @get method GET route { basic_auth { } file_server @get browse webdav } root * /opt/webdav } ``` -------------------------------- ### IMAPFilter Configuration Template Source: https://nali.org/wiki/tech/apps/imapfilter A Lua configuration file for IMAPFilter. It includes functions to retrieve passwords from 'pass' and ensure folders exist, along with example filtering rules. ```lua -- Get password from pass program function get_password(account) local handle = io.popen('pass Email/' .. account) local result = handle:read("*a") handle:close() return result:gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace end -- Function to safely create folders if they don't exist function ensure_folder(account, folder) if not account[folder] then account:create_folder(folder) end end -- Account information my_email_account = IMAP { server = '', username = '', password = get_password('account1'), ssl = 'auto' } ensure_folder(my_email_account, 'Archive') ensure_folder(my_email_account, 'Later') -- Get messages from INBOX my_inbox = my_email_account.INBOX:select_all() -- Filter messages my_inbox:contain_from('subscribers@hellworld.com'):move_messages(my_email_account['Archive']) my_inbox:contain_from('John Smith'):move_messages(my_email_account['Later']) ``` -------------------------------- ### View Default Key Mappings Source: https://nali.org/wiki/tech/apps/neovim Access Neovim's built-in help system to view default key mappings. ```vim :help index ``` -------------------------------- ### Zsh Function to List Upcoming Events Source: https://nali.org/wiki/tech/apps/plann A Zsh function that takes the number of days as an argument and dynamically calculates the start and end dates to list upcoming calendar events using plann. ```zsh plann_events() { # Check if the number of days is provided if [ -z "$1" ]; then echo "Usage: plann_events " return 1 fi # Number of days local days=$1 # Get the current date local start_date=$(date +%Y-%m-%d) # Get the date 'days' from now local end_date=$(date -v +${days}d +%Y-%m-%d) # Run the plann command with the calculated dates plann --config-section all select --event --start "$start_date" --end "$end_date" list } ``` -------------------------------- ### List GPG Keys Source: https://nali.org/wiki/tech/apps/imapfilter Lists your GPG keys to find the key ID required for initializing 'pass'. ```bash gpg --list-keys --keyid-format LONG ``` -------------------------------- ### Update DNS Settings Source: https://nali.org/wiki/tech/devops/cli Sets new DNS server addresses for a specified network device on macOS. Use this to change DNS servers, for example, to 1.1.1.1 and 8.8.8.8. Verify changes with the `-getdnsservers` command. ```bash sudo networksetup -setdnsservers 1.1.1.1 8.8.8.8 ``` -------------------------------- ### Build Docker Image Source: https://nali.org/wiki/tech/devops/docker Command to build a Docker image from a Dockerfile in the current directory. Tag the image for easy reference. ```bash docker build -t minimal-ubuntu . ``` -------------------------------- ### List Calendar Events using Plann CLI Source: https://nali.org/wiki/tech/apps/plann Executes the plann command to select and list events within a specified date range. Uses the 'all' configuration section to pull from all defined calendars. ```bash plann --config-section all select --event --start 2024-05-01 --end 2024-05-14 list ``` -------------------------------- ### Check VPN IP with Gluetun Source: https://nali.org/wiki/tech/devops/cli Execute a command within a Docker container named 'gluetun' to fetch the current public IP address via http://ipecho.net/plain. ```bash docker exec gluetun sh -c "wget http://ipecho.net/plain -O - -q ; echo" ``` -------------------------------- ### Login to Maubot CLI Source: https://nali.org/wiki/tech/apps/matrix Log in to the Maubot command-line interface and authenticate with your homeserver. You will be prompted for the username and password of the Synapse account. ```bash ? Username rssbot ? Password ****************************** ``` -------------------------------- ### Open UDP Port in Ubuntu Source: https://nali.org/wiki/tech/devops/cli Configure the firewall on an Ubuntu system to allow incoming UDP traffic on a specified port. ```bash sudo apt-get install firewalld sudo firewall-cmd --permanent --zone=public --add-port=/udp sudo firewall-cmd --reload service start firewalld ``` -------------------------------- ### Launch Container on Specific Network Source: https://nali.org/wiki/tech/devops/lxc-lxd Launches a new Ubuntu Jammy container named 'c1' and connects it to the 'lxdbriso' network. This ensures the container uses the isolated network configuration. ```bash lxc launch images:ubuntu/jammy c1 -n lxdbriso ``` -------------------------------- ### Initialize Pass with GPG Key Source: https://nali.org/wiki/tech/apps/imapfilter Initializes the 'pass' password manager using your GPG key ID. Ensure your GPG keys do not have a password for automated use. ```bash pass init XXXXXXXXXXXXXXXX ``` -------------------------------- ### Register New Matrix User with Podman Source: https://nali.org/wiki/tech/apps/matrix Register a new Matrix user for a bot within a running Synapse container using Podman exec. Replace with a secure password. ```bash podman exec -it synapse_synapse_1 bash register_new_matrix_user -u rssbot -p --no-admin -c /data/homeserver.yaml ``` -------------------------------- ### Turn on Pi-hole via API Source: https://nali.org/wiki/tech/privacy This curl command enables Pi-hole using its API. Ensure you replace , , and with your correct values. ```bash curl "http://:/admin/api.php?enable&auth=" ``` -------------------------------- ### Save Key Mappings to File Source: https://nali.org/wiki/tech/apps/neovim Redirect Neovim's verbose map output to a text file for later reference. ```vim :redir! > vim_keys.txt :silent verbose map :redir END ``` -------------------------------- ### Commit and Push Changes with Chezmoi Source: https://nali.org/wiki/tech/devops/git Use these commands to stage, commit, and push changes managed by Chezmoi. ```bash chezmoi cd chezmoi git add . chezmoi git -- commit -m "Adding a real message" chezmoi git -- push ``` -------------------------------- ### Fast File Copy Between Servers (LAN) Source: https://nali.org/wiki/tech/devops/cli Efficiently transfer numerous small files between servers on the same LAN. This method uses tar, pv for progress, and netcat (nc) for data streaming. ```bash tar -cf - -C /home/nali/sf-back . | pv | nc -l ``` ```bash nc | pv | tar -xf - -C ``` -------------------------------- ### Enable IP Forwarding Source: https://nali.org/wiki/tech/devops/docker Commands to enable IP forwarding on the host system, which is necessary for routing traffic between networks, including Docker containers and the internet. It also shows how to make the setting permanent. ```bash sudo sysctl -w net.ipv4.ip_forward=1 # Make it permanent echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.conf sudo sysctl -p ``` -------------------------------- ### List Dependabot Workflow Runs Source: https://nali.org/wiki/tech/devops/git Check for existing Dependabot workflow runs in a GitHub repository. Requires GitHub CLI. ```bash gh run list --workflow="Dependabot Updates" --repo / ``` -------------------------------- ### Configure Default Network ACLs Source: https://nali.org/wiki/tech/devops/lxc-lxd Sets default egress and ingress actions to 'allow' for both the default network 'lxdbr0' and the isolated network 'lxdbriso'. This is a prerequisite for applying specific ACL rules. ```bash lxc network set lxdbr0 \ security.acls.default.egress.action=allow \ security.acls.default.ingress.action=allow lxc network set lxdbriso \ security.acls.default.egress.action=allow \ security.acls.default.ingress.action=allow ``` -------------------------------- ### Configure Synapse Appservice Address for Rootless Podman Source: https://nali.org/wiki/tech/apps/matrix Adjust the Synapse config.yaml to correctly point to the appservice address when running Synapse with rootless Podman. Use 'host.containers.internal' to reach services running on the host. ```yaml appservice: # The address that the homeserver can use to connect to this appservice. address: http://host.containers.internal:29317 ``` -------------------------------- ### Configure Podman rootless overlayfs storage Source: https://nali.org/wiki/tech/devops/docker This configuration is necessary for Podman rootless mode when using the overlayfs storage driver on systems where file handles are not supported. Edit or create `~/.config/containers/storage.conf`. ```ini [storage] driver = "overlay" [storage.options] mount_program = "/usr/bin/fuse-overlayfs" ``` -------------------------------- ### Insert Text in Visual Block Mode Source: https://nali.org/wiki/tech/apps/neovim Use visual block mode to insert text at the beginning of multiple selected lines. ```vim 1. # Go into visual block mode 2. Select lines 3. # This will make cursor jump to first line of the selected block 4. Type whatever you want to insert # You'll only see it on the first line 5. # Then it will show up for all the lines ``` -------------------------------- ### Shell Script for Blank Chromium Profile Source: https://nali.org/wiki/tech/apps/chromium This script creates a temporary directory for a new Chromium profile on each startup, ensuring a clean session. Save this script, make it executable, and then use it with AppleScript. ```shell #!/bin/zsh # Create a random directory in /tmp TMP_DIR=$(mktemp -d /tmp/chromeprofile.XXXXXX) # Run Chromium with the random user data directory /Applications/Chromium.app/Contents/MacOS/Chromium --user-data-dir="$TMP_DIR" # Clean up the temporary directory after Chromium closes rm -rf "$TMP_DIR" ``` -------------------------------- ### Enable Podman systemd linger for rootless users Source: https://nali.org/wiki/tech/devops/docker This command enables lingering for a user's systemd session, which can resolve issues with cgroupv2 managers in Podman rootless mode. Run this command as the user experiencing the issue. ```bash loginctl enable-linger $USER ``` -------------------------------- ### List Last 10 Created Bitwarden Logins Source: https://nali.org/wiki/tech/privacy This command uses `jq` to parse a Bitwarden export file and display the IDs of the last 10 created logins, sorted by creation date. ```APIDOC ## List Last 10 Created Bitwarden Logins ### Description This command uses `jq` to parse a Bitwarden export file and display the IDs of the last 10 created logins, sorted by creation date. ### Command ```bash jq '.items | sort_by(.creationDate) | reverse | .[0:10] | .[].id' < export.json ``` ### Parameters - `export.json`: The name of your exported Bitwarden login file. ``` -------------------------------- ### Set Container CPU Limits Source: https://nali.org/wiki/tech/devops/lxc-lxd Sets the maximum number of CPUs that the container 'sso-container' can use to 2. This helps in managing resource allocation. ```bash lxc config set sso-container limits.cpu 2 ``` -------------------------------- ### Wrap AES Key with Oracle Wrapping Key Source: https://nali.org/wiki/tech/devops/cli Encrypt a locally generated AES key using an Oracle-provided public wrapping key (wrappingKey.pub) with OAEP padding and SHA256. ```bash openssl pkeyutl -encrypt -in my_aes_key.bin -pubin -inkey wrappingKey.pub -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256 -out my_wrapped_key.bin ``` -------------------------------- ### Generate Newt Client Keys and PKCS12 Bundle Source: https://nali.org/wiki/tech/devops/pangolin Creates a private key, certificate signing request (CSR), and signs it with the CA to generate a client certificate for Newt. A passwordless PKCS12 bundle is created for the Newt client. ```bash # Generate private key openssl genrsa -out newt-client-key.pem 4096 ``` ```bash # Generate certificate signing request openssl req -new -key newt-client-key.pem -out newt-client.csr -subj "/C=US/ST=State/L=City/O=Pangolin/OU=VPN/CN=newt-client" ``` ```bash # Sign the certificate with CA openssl x509 -req -days 365 -in newt-client.csr -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out newt-client.pem ``` ```bash # Create PKCS12 bundle for Newt (passwordless) openssl pkcs12 -export -out newt-client.p12 -inkey newt-client-key.pem -in newt-client.pem -certfile ca-cert.pem -passout pass: ``` -------------------------------- ### Create AES Encryption Key Source: https://nali.org/wiki/tech/devops/cli Generate a random 32-byte AES key using OpenSSL for use with Oracle Cloud Infrastructure. ```bash openssl rand 32 > my_aes_key.bin ``` -------------------------------- ### List Last 10 Created Bitwarden Logins Source: https://nali.org/wiki/tech/privacy Use this jq query to sort and display the IDs of the last 10 created logins from a Bitwarden export file. ```bash jq '.items | sort_by(.creationDate) | reverse | .[0:10] | .[].id' < export.json ``` -------------------------------- ### Add ACL to Existing Network Configuration Source: https://nali.org/wiki/tech/devops/lxc-lxd Demonstrates how to add a new ACL ('external-only') to a network ('lxdbr0') that already has existing ACLs defined. This is useful for incrementally updating network security policies. ```bash lxc network set lxdbr0 security.acls=external-only,previous-acl ``` -------------------------------- ### Update Ubuntu System Source: https://nali.org/wiki/tech/devops/cli Perform a comprehensive update of an Ubuntu system, including package lists, upgrades, distribution upgrades, and removal of unused packages. ```bash apt -y update \ && apt -y upgrade \ && apt -y dist-upgrade \ && apt -y autoremove \ && apt -y autoclean \ && apt -y clean \ && apt -y remove $(deborphan) ``` -------------------------------- ### Run Mautrix Telegram Bot Source: https://nali.org/wiki/tech/apps/matrix Execute the mautrix-telegram bot using the python3 interpreter. Note the underscore in the module name when running. ```bash python3 -m mautrix_telegram ``` -------------------------------- ### Reset UFW firewall and configure rules Source: https://nali.org/wiki/tech/devops/cli Resets iptables and UFW to a clean state, then configures essential rules for incoming SSH, HTTP, and HTTPS traffic, and allows all outgoing traffic. This is useful when firewall configurations become unmanageable. ```bash udo apt update && \ sudo apt install -y ufw && \ sudo iptables -F && \ sudo iptables -X && \ sudo iptables -t nat -F && \ sudo iptables -t nat -X && \ sudo iptables -t mangle -F && \ sudo iptables -t mangle -X && \ sudo ufw --force reset && \ sudo ufw default deny incoming && \ sudo ufw default allow outgoing && \ sudo ufw allow 22/tcp && \ sudo ufw allow 80/tcp && \ sudo ufw allow 443/tcp && \ sudo ufw --force enable && \ sudo ufw status verbose ``` -------------------------------- ### Set Custom DNS for Specific Client Source: https://nali.org/wiki/tech/networking/dns This command adds a static mapping to the DHCP server configuration, specifying custom DNS servers for a particular device. Replace placeholders with your network's specific details. ```bash set service dhcp-server shared-network-name subnet static-mapping static-mapping-parameters "option domain-name-servers , ;" ``` ```bash set service dhcp-server shared-network-name eth2_dhcp subnet 192.168.200.0/24 static-mapping Bedroom_ROKU static-mapping-parameters "option domain-name-servers 8.8.8.8, 8.8.4.4 ;" ``` -------------------------------- ### Check Apple SMC fan and temperature sensors Source: https://nali.org/wiki/tech/devops/cli This command samples SMC data once to retrieve information about fan speeds and CPU/GPU die temperatures. Useful for monitoring hardware status on Apple devices. ```bash sudo powermetrics -n 1 --samplers smc | egrep -i "FAN|CPU die|GPU die" ``` -------------------------------- ### Swift Linker Errors: Empty Compatibility Libraries Source: https://nali.org/wiki/tech/devops/programming These linker errors indicate that essential Swift compatibility libraries are empty. This often occurs when there's a mismatch between the project's target Swift version and the versions supported by third-party packages. ```text ld: multiple errors: file is empty in '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCompatibility56.a'; file is empty in '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCompatibilityPacks.a' clang: error: linker command failed with exit code 1 (use -v to see invocation) ```