This commit is contained in:
mjallen18
2025-02-20 11:32:05 -06:00
parent 43ecae9920
commit 948e4b199a
22 changed files with 218 additions and 276 deletions

View File

@@ -1 +0,0 @@
nixos-rebuild switch --use-remote-sudo --target-host admin@jallen-nas.local --build-host localhost --flake .#jallen-nas

View File

@@ -1,12 +0,0 @@
#! /bin/sh
# fix-vscode-server-node.sh
# https://github.com/microsoft/vscode-remote-release/issues/648#issuecomment-503148523
cd ~/.vscode-server/bin/*
if ! ./node -e "require('process').exit(0)"
then
echo patching node binary $(readlink -f node)
rm node
ln -s $(which node)
else
echo node is working $(readlink -f node)
fi

View File

@@ -1,73 +0,0 @@
#!/usr/bin/env python3
import subprocess
import socket
import logging
from typing import List, Optional
def check_internet_connection(hosts_to_check: Optional[List[str]] = None) -> bool:
"""
Check internet connectivity by attempting to connect to reliable hosts.
:param hosts_to_check: Optional list of hosts to check.
:return: Boolean indicating if internet connection is available
"""
if hosts_to_check is None:
hosts_to_check = [
"8.8.8.8", # Google DNS
"1.1.1.1", # Cloudflare DNS
"9.9.9.9" # Quad9 DNS
]
for host in hosts_to_check:
try:
# Create a socket connection with a 5-second timeout
socket.create_connection((host, 53), timeout=5)
return True
except (socket.error, socket.timeout):
continue
return False
def reset_wifi_card() -> bool:
"""
Execute WiFi card reset commands.
:return: Boolean indicating if reset commands were successful
"""
reset_commands = [
"echo 1 | sudo -u root tee /sys/bus/pci/devices/0000:09:00.0/reset",
"sudo rmmod iwlwifi",
"sudo modprobe iwlwifi"
]
try:
for command in reset_commands:
result = subprocess.run(
command,
shell=True,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
print(f"Executed: {command}")
print(f"Output: {result.stdout}")
return True
except subprocess.CalledProcessError as e:
print(f"Error resetting WiFi: {e}")
print(f"Error output: {e.stderr}")
return False
def main():
"""
Check internet connection and reset WiFi if not connected.
"""
if not check_internet_connection():
print("No internet connection detected. Attempting WiFi reset...")
reset_wifi_card()
else:
print("Internet connection is stable. No reset needed.")
if __name__ == "__main__":
main()

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env bash
sudo nix-store --gc

View File

@@ -1,2 +0,0 @@
#!/bin/bash
nix run nix-darwin -- switch --flake ~/nix-config

View File

@@ -1,7 +0,0 @@
#!/usr/bin/env bash
zpool import -R /mnt -f "Main Pool"
zpool import -R /mnt -f "Safe SSD"
zpool import -R /mnt -f "Junk"
zfs load-key -L file:///root/main-pool.key "Main Pool"
zfs load-key -L file:///root/safe-ssd.key "Safe SSD"
zfs mount -a

View File

@@ -1,18 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (pkgs: [ pkgs.turtle ])"
{-# LANGUAGE OverloadedStrings #-}
import Turtle
main = sh $ do
homedir <- home
subdir <- ls $ homedir </> ".vscode-server/bin/"
let nodepath = subdir </> "node"
badnode <- isNotSymbolicLink nodepath
if badnode
then do
mv nodepath (subdir </> "node_backup")
symlink "/run/current-system/sw/bin/node" nodepath
echo ("Fixed " <> repr subdir)
else do
echo ("Already fixed " <> repr subdir)

View File

@@ -1 +0,0 @@
/run/current-system/sw/bin/node

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env bash
sudo su - root
echo 293000000 > /sys/class/drm/card0/device/hwmon/hwmon0/power1_cap

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
echo 1 | sudo -u root tee /sys/bus/pci/devices/0000\:09\:00.0/reset
sudo rmmod iwlwifi
sudo modprobe iwlwifi

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env bash
sudo nix flake update