Created
December 15, 2021 00:06
-
-
Save romanblanco/679f84d850c06e08ca7d7c2ee851e0b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.openbsd.org/faq/ | |
# https://www.openbsdhandbook.com | |
# https://sohcahtoa.org.uk/openbsd.html | |
# /usr/bin/help | |
# man apropos | |
# man 8 afterboot | |
#•••••••• | |
# Network | |
#•••••••• | |
# setup wifi | |
doas ifconfig iwn0 up | |
doas ifconfig iwn0 nwid coolwifiname wpakey secretpassword | |
# ifconfig iwn0 -nwid # to disconnect | |
dhclient iwn0 | |
# for permanent configuration use /etc/hostname.<device> | |
# (e.g. /etc/hostname.iwn0): | |
# | |
# ``` | |
# nwid coolwifiname wpakey secretpassword | |
# dhcp | |
# sh /etc/netstart # to restart network | |
# ``` | |
# setup wireguard | |
cp wireguard_x230.conf /etc/wireguard/wg0.conf | |
chmod 700 /etc/wireguard | |
wg-quick up wg0 | |
# allow ipv6 forwarding in /etc/sysctl.conf | |
sysctl net.inet6.ip6.forwarding=1 | |
# http://sbc.io/hosts/alternates/fakenews-gambling-porn-social/hosts into /etc/hosts | |
#••••••••••••••• | |
# System updates | |
#••••••••••••••• | |
# to update firmware (because it can't be attached to installation) | |
doas fw_update | |
# to update system | |
doas syspatch | |
# install packages | |
pkg_add vim git fish htop ttyplot ranger ripgrep pdftk ImageMagick ffmpeg gnuwatch | |
pkg_add wireguard-tools lynx newsboat gomuks transmission syncthing tor httrack rtl-sdr | |
pkg_add feh i3 xclip rxvt-unicode symbola-ttf iosevka # (iosevka instead of jetbrains-mono) | |
pkg_add okular keepassxc vlc | |
pkg_add firefox tor-browser | |
pkg_add rust python # (python 3) | |
# start syncthing | |
rcctl set syncthing user rblanco | |
# update resource limit for daemon in /etc/login.conf: | |
# syncthing:\ | |
# :openfiles-max=16384:\ | |
# :openfiles-cur=8192:\ | |
# :tc=daemon: | |
rcctl enable syncthing | |
# fix memory issues of firefox | |
usermod -G staff rblanco # add user to staff (check by `userinfo rblanco`) | |
# #foo cat /etc/login.conf | |
# .... lines .... | |
# staff:\ | |
# :datasize-cur=3072M:\ | |
# :datasize-max=infinity:\ | |
# :maxproc-max=512:\ | |
# :maxproc-cur=256:\ | |
# :ignorenologin:\ | |
# :requirehome@:\ | |
# :tc=default: | |
# .... lines .... | |
cp /etc/examples/doas.conf /etc/ | |
# give user permission to run commands as root without password (ultimate power): | |
# permit nopass rblanco as root | |
# allow users to power off computer: | |
# permit nopass :staff as root cmd zzz | |
# permit nopass :staff as root cmd ZZZ | |
# permit nopass :staff as root cmd reboot args | |
# permit nopass :staff as root cmd shutdown args -p now | |
#•••••••••••• | |
# Environment | |
#•••••••••••• | |
# disable xconsole on startup by commenting in /etc/X11/xenodm/Xsetup_0 | |
#•••••••••••••••••••••••••• | |
# Mount USB storage devices | |
#•••••••••••••••••••••••••• | |
disklabel sd0 # check the partition name | |
mount /dev/sd0i /mnt/usb | |
umount /mnt/usb | |
#•••••••••••• | |
# Performance | |
#•••••••••••• | |
# hibernate at 5% remaining battery | |
# in /etc/rc.conf.local: | |
# ampd_flags=-A -Z 5 | |
# battery optimizations | |
doas rcctl -f start apmd | |
# https://github.com/krzysztofengineer/openbsd/blob/master/tasks/02-power-management.md#set-the-performance-adjustment-mode | |
doas rcctl enable ampd | |
apm -L # sets hw.setperf to 0 (sysctl) | |
# to cut out image pixels 400 width, 30 height | |
# convert edc/IMG_20211002_154609-gray.jpg -shave 400x30 tmp/400_30_2.jpg | |
#•••••••••••••• | |
# Audio & Video | |
#•••••••••••••• | |
# to turn off system bell | |
xset b off | |
# audio and video recording is disabled by default | |
# - man 4 video -> to record video: | |
doas sysctl kern.video.record=1 | |
doas chown $USER /dev/video | |
ffmpeg -f v4l2 -input_format mjpeg -video_size 1280x720 -i /dev/video ~/video.mkv # 'q' to stop | |
# - man 4 audio -> to record audio: | |
doas sysctl kern.audio.record=1 | |
# - man 8 mixerctl -> to unmute microphone: | |
doas mixerctl record.adc-0:1_mute=off | |
aucat -o file.wav # CTRL+C to stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment