Skip to content

Instantly share code, notes, and snippets.

View porteusconf's full-sized avatar

porteusconf porteusconf

  • 22:04 (UTC -05:00)
View GitHub Profile
@porteusconf
porteusconf / auto-add-printer.md
Last active February 7, 2026 05:38
Unattended linux laptop script in rc.local to share to wifi any printer directly connected to laptop via ethernet cable to ethernet printer (like old HP pcl3)

Use-case: Laptop (or pi) running debian-flavor linux with internet via wifi. Is connects by direct ethernet cable to older HP-Laserjet with port 9100 open but without IPP printing. The script makes port 9100 availble on wifi (via iptables and avahi-publish). Printer never can see internet, and cups is not needed at all, tho cups can be running, as long as printer sharing is off.

There are commercial devices to add wifi capability to ethernet-only laser printers, but I wanted a simpler way that was as automatic as possible: the less user intervention needed the better. I know cups can share printers, but while it seemed to work at first, sometimes it would not, with cups saying "Filter failed", or garbled printouts due to postcript ppd I think.

For example, when I connected my old HP LaserJet P2055dn by usb to my debian laptop, it automatically shared it (as I told cups to share printers. But cups, without asking, chose to use a postscript driver, which did not work very well. However, when I connect by

@porteusconf
porteusconf / eos-tweaks.md
Last active January 22, 2026 02:30
eos (endless-OS 6.0) tweaks like how to install homebrew/linuxbrew package manager (since apt does not work in eos)

Stop audit from spamming dmesg by adding audit=0 to kernel params in *.conf file in /boot/loader/entries/

cd /boot/loader/entries/
sudo nano <the conf file?  ### add " audio=0 " after  "loglevel=0" so it says:
$ head -3 *.conf
title Endless OS 6.0.8 (ostree:0)
version 1
options rw splash plymouth.ignore-serial-consoles quiet loglevel=0 audit=0 ostr...
@porteusconf
porteusconf / session_log-chromeos-flex.txt
Last active August 30, 2025 14:30
Use crosh in chromeos to do short SMART test of ssd/hdd and extensive bad-blocks surface scan of entire drive (for flex or non-flex chromeos)
### chromeos has storage_test_1 and storage_test_2 to test drive (sdd or hdd)
### Hit ctrl-alt-T then at crosh prompt type:
crosh> storage_test_1 --help
storage_test_1
Performs a short offline SMART test.(Always takes just 1 minute.)
crosh>
Welcome to crosh, the ChromeOS developer shell.
@porteusconf
porteusconf / crew-and-non-crew-backup-readme.md
Last active August 13, 2024 02:26
in dev mode on ChromeOS, backup and restore chromebrew (crew) and non-crew, that is manually installed items, in /use/local/bin

How I backup/restore my chromebrew setup and manually-installed items in /usr/local/bin by using group

In dev mode chromeos, most mounts are noexec except /usr/local so that is why executeables are in /usr/local/bin Almost everything in my /usr/local was installed by chromebrew (crew) except a few items I manually copied to /usr/local/bin

As a way to tag items I manually added, I change the group from chronos to some other group and I chose midis which seems safe. So for example, I like to keep a non-executeable list of what crew has installed in /usr/local/bin

crew list installed > /usr/local/bin/crew-list-installed.txt

I also sometimes manually install in /usr/local/bin some *.sh or a few binaries crew does not (yet) provide, like btm.

@porteusconf
porteusconf / crosflex_downloader.sh.md
Last active August 12, 2025 14:59 — forked from sj-dan/crosflex_downloader.sh
Script to fetch and download the latest version of the Chrome OS Flex image

Better than forked gist here is Alternative method below...

#!/bin/bash

URLs=$(curl "https://dl.google.com/dl/edgedl/chromeos/recovery/cloudready_recovery2.json" \
-s --output - | \
grep "^.*\"url\".*$" | \
sed "s/.*\"url\": \"\(.*\)\".*$/\1/g")

printf "\nPick which channel to download your image from. Channel name is near the end of the URL.\n\n"
@porteusconf
porteusconf / cx_Freeze-setup-inside-venv.sh
Last active February 24, 2024 04:05
setup venv to have cx_Freeze create standalone executables from Python scripts, is cross-platform, and should work on any platform that Python itself works on.
### https://marcelotduarte.github.io/cx_Freeze/
### https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade cx_Freeze
### for appimage https://cx-freeze--2050.org.readthedocs.build/en/2050/setup_script.html#bdist-appimage
@porteusconf
porteusconf / pinglog.sh
Last active January 30, 2024 00:54
Internet connectivity test. Dumb linux or windows shell script that logs to csv file only those pings that fail. Likely ok to leave running for days.
#!/bin/sh
echo "for each ping that fails, adds one line to csv log file with iso-8601 date and host"
echo "Usage: ./pinglog.sh host-to-ping i.e. ./pinglog.sh google.com "
# to do: if continually fails, don't log each failure, just start and stop of failures.
# i guess something like if previous fail was less than X secs from current, don't log.
while true ;
do
# change -I arg from wlan1 to whatever interface you want to use
ping -c1 -I wlan1 $1 > /dev/null
### ping -n 1 $1 > /dev/null ### for windows with gitbash (see comment below)
@porteusconf
porteusconf / for-owc-2lines-to-add-to-drivedb.sh
Created January 3, 2023 22:50
2 lines added to drivedb.h to support my old (2011-era hacked? 1TB SSD) "OWC Mercury Extreme Pro 6G" with firmware SCFM13.2
## In 2022 I bought a 1tb used SSD on ebay. I needed to add two lines to drivedb.h so smartctl would find it info for it:
cat << EOF
### Add two lines to drivedb.sh shown with (+) in diff output below.
### after adding the 2 lines, your diff output should be similar
### bash-3.2$ diff -C drivedb-oem.h drivedb-owc.h
"OWC Aura Pro( 6G SSD)?|" // tested with OWC Aura Pro 6G SSD/507ABBF0, OWC Aura Pro/603ABBF0
"OWC Mercury Electra (Pro )?[36]G SSD|" // tested with
// OWC Mercury Electra 6G SSD/502ABBF0, OWC Mercury Electra Pro 3G SSD/541ABBF0
+ "OWC Mercury Extreme Pro 6G|" // tested with
@porteusconf
porteusconf / chrome-fix-for-mojave-patcher.command
Last active November 2, 2022 15:25
May fix blank chrome window on dosdude patched unsupported macs with 10.14 or maybe 10.15
echo " reinstall all patches and rebuild kext first. I did not reboot. YMMV "
open /Applications/Utilities/Patch\ Updater.app
echo " warning... this will delete all chome profiles! You'll have to sign in and re-sync."
mv ~/Applications/Chrome\ Apps.localized/ /tmp/
mv ~/Application\ Support/Google/ /tmp
mv ~/Library/Google /tmp
rm -rf /Library/Google
rm -rf /Library/Application\ Support/Google
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-gpu chrome://extensions
@porteusconf
porteusconf / rosetta2detect.sh
Created September 29, 2022 02:08
zsh shell script to detect if running under rosetta on apple-silicon m1 macs
#!/bin/zsh
# Based on https://indiespark.top/software/detecting-apple-silicon-shell-script/
arch_name="$(uname -m | cut -c 1-3)" # x86 or arm (to match arm64 or arm64e)
echo -n ${arch_name} "= specifically "
uname -m
if [ "${arch_name}" = "x86" ]; then
if [ "$(sysctl -in sysctl.proc_translated)" = "1" ]; then
echo "Running on Rosetta 2"
else
echo "Running on native Intel"