Skip to content

Instantly share code, notes, and snippets.

View abenson's full-sized avatar

Andrew Benson abenson

  • San Antonio, TX
View GitHub Profile
@abenson
abenson / share-wlan.sh
Created February 24, 2022 23:44
Share WLAN to Ethernet
#!/bin/sh
SYSCTL="sysctl -w net.ipv4.ip_forward"
case "$1" in
"-e")
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -I POSTROUTING -o wlan0 -j MASQUERADE
iptables -I FORWARD -i eth0 -o wlan0 -j ACCEPT
ip addr del 10.10.10.1 dev eth0
@abenson
abenson / nvidia-status
Last active November 23, 2022 00:28
nvidia-status
#!/bin/sh
if [ "$1" = "-q" ]; then
QUIET="true"
fi
for dev in /proc/driver/nvidia/gpus/*/power; do
busid=$(echo "$dev" | cut -d/ -f6)
if grep -q 'Video Memory:[ ]\+Off' "$dev"; then
if [ -z $QUIET ]; then
#!/bin/sh
for bat in /sys/class/power_supply/BAT?/uevent; do
_state=$(grep -w POWER_SUPPLY_NAME "$bat" | cut -d= -f2)
_charge=$(grep -w POWER_SUPPLY_CHARGE_NOW "$bat" | cut -d= -f2)
_full=$(grep -w POWER_SUPPLY_CHARGE_FULL "$bat" | cut -d= -f2)
_design=$(grep -w POWER_SUPPLY_CHARGE_FULL_DESIGN "$bat" | cut -d= -f2)
printf "$POWER_SUPPLY_NAME Status: %s\n" "${_state}"
printf "$POWER_SUPPLY_NAME Charge: %d%%\n" $(( (_charge * 100) / _full ))
printf "$POWER_SUPPLY_NAME Health: %d%%\n" $(( (_full * 100) / _design ))

Void Linux on the MSI Prestige 14 (A10SC)

Pretty much everything is working out of the box. The screen is beautiful and the keyboard is nice to type on.

The battery life when just doing using the laptop as a portable laptop is pretty good. It's light, thin.

I look forwarding to testing its for some light gaming, but until then, here's what I did to get everything working on it.

Basic Installation

#!/bin/bash
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
exec "$@"
@abenson
abenson / checkupdates
Created January 7, 2020 20:30
check void updates
#!/bin/sh
URL='https://alpha.de.repo.voidlinux.org/void-updates/void-updates.txt'
if [ -z "$1" ]; then
echo "usage: $0 <name>"
exit
fi
curl -sL "$URL" | sed -n "/$1/,/^$/p"
@abenson
abenson / wttr
Created December 17, 2019 04:43
#!/bin/sh
curl -sL "https://wttr.in/${1}?m"
@abenson
abenson / git.sh
Last active June 29, 2020 01:00
getting lazier and lazier
alias co='git checkout'
alias ci='git commit'
alias ga='git add'
alias addp='git add -p'
alias status='git status'
alias gdiff='git diff'
alias gpatch='git diff --no-prefix'
alias show='git show'
alias wdiff='git wdiff'
alias br='git branch'
@abenson
abenson / expand_net
Created March 15, 2019 01:13
"expand_net" wrapper for nmap
#!/bin/sh
SORT="cat"
if [ "$1" = "-r" ]; then
shift
SORT="sort -R"
fi
if [ -z "$1" ] || [ "$1" = "-h" ]; then
@abenson
abenson / lstwgdocs
Last active June 19, 2019 17:47
wordgrinder helpers
#!/bin/sh
if [ -z "$1" ]; then
echo "usage: $0 <file.wg>"
exit
fi
egrep '.documents.[0-9]+.name' "$1" | awk -F ': ' '{ print $2;}'