Skip to content

Instantly share code, notes, and snippets.

View ownown's full-sized avatar
🌱

Oliver Newman ownown

🌱
View GitHub Profile
dpkg --print-architecture # amd64
uname -m # x86_64
#!/bin/bash
# Control which monitor the login screen appears on
sudo cp ~/.config/monitors.xml /var/lib/gdm3/.config/ && sudo chown gdm:gdm /var/lib/gdm3/.config/monitors.xml
@ownown
ownown / get_ipv4.sh
Last active September 21, 2023 12:31
Get the external IP of the current device
curl -4 https://ipecho.net/plain; echo
ssh-keygen -t ed25519 -C "EMAIL HERE"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/KEY_NAME
@ownown
ownown / etc_netplan_01-network-manager-all.yaml
Last active April 14, 2026 12:02
Set static IP for ethernet using netplan
network:
version: 2
renderer: NetworkManager
ethernets:
enp4s0:
dhcp4: no
addresses: [10.2.2.3/24]
routes:
- to: default
via: 192.168.1.1
@ownown
ownown / get_etho0_mac.sh
Last active December 11, 2024 17:52
Get MAC address
# MAC
ip l show dev eth0 | grep -o -E ..:..:..:..:..:.. | head -n 1
# IP
ip a show dev eth0 | grep -o -P "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(?=\/)"
[Unit]
Description=Service Name
[Service]
ExecStart=/bin/bash -c ""
Restart=always
[Install]
WantedBy=multi-user.target
@ownown
ownown / rpi_gpio_high_on_start
Last active January 18, 2023 14:57
Set Raspberry Pi GPIO high on boot
From https://forums.raspberrypi.com/viewtopic.php?t=175161#p1117946
Add to /boot/config.txt
dtoverlay=gpio-poweroff,gpiopin=4,active_low
@ownown
ownown / wpa_supplicant.conf
Last active December 17, 2021 16:38
WiFi config for a Raspberry Pi. Fill in the SSID and PSK with the details for the required WiFi network
country=gb
update_config=1
ctrl_interface=/var/run/wpa_supplicant
network={
scan_ssid=1
ssid=""
psk=""
}
@ownown
ownown / nmap-ssh-checker.sh
Last active December 26, 2022 14:35
Use nmap and awk to get IPs of devices with open SSH ports
# -p - ports to check
# -oG output in grep-able format
sudo nmap 192.168.0.0/24 -p 22 -oG - | awk '$5 ~ /open/ {print $2}'