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 / wttr
Created December 17, 2019 04:43
#!/bin/sh
curl -sL "https://wttr.in/${1}?m"
@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"
#!/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 "$@"

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/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 ))
@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
@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 / typst.nanorc
Created October 29, 2024 18:59
typst.nanorc
syntax "typst" "\.typ(st)?"
comment "/*|*/"
# Markup
## Strong
color bold,normal "(^|[[:space:]])(_[^ ][^_]*_|\*[^ ][^*]*\*)"
## Emphasis
color italic,normal "(^|[[:space:]])(_[^ ][^_]*_|_[^ ][^*]*_)"
## Label