Skip to content

Instantly share code, notes, and snippets.

View MarkWalters-dev's full-sized avatar

MarkWalters.dev MarkWalters-dev

View GitHub Profile
@MarkWalters-dev
MarkWalters-dev / ghgist
Last active August 28, 2023 18:32
Add and update gists
#!/usr/bin/env bash
#🌩️ gist 992616d92e2cfca8b8e999490f16c1fc ghgist
# Uses gh to create and update gists
# TODO:
# If .gist used then setup symlinks
# Need method to gh gist clone without using a .gist folder
# look for short description in file and use it
@MarkWalters-dev
MarkWalters-dev / alert
Last active August 28, 2023 15:05
Simple script to let me know that a long running command is done. Uses ntfy, dunst/notify-send, and is ssh aware
#!/usr/bin/env bash
#🌩️ gist 3c02823a6bd111c90bad8344052143e6 alert
# Simple script to let me know that a long running command is done
# It uses both the ntfy service and either notify-send or dunst
# If it is running over a ssh session it will also try to use your local computers notify service
# Typical usage in a script:
# . $HOME/.bin/common/alert
@MarkWalters-dev
MarkWalters-dev / replace-debian-with-arch.txt
Last active October 6, 2022 04:10 — forked from m-ou-se/replace-debian-with-arch.txt
Instructions to replace a live Debian installation with Arch
# I am using this to install arch on an ionos vps
# manjaro doesn't work beause it uses the manjaro config
# The debian iso doesn't have apt nor ssh. I need ssh because I can't paste in their web kvm.
# Using the ubuntu iso, use the help menu, enter shell
# In the kvm console, manually type the following:
useradd -m john
passwd
passwd john
@MarkWalters-dev
MarkWalters-dev / ledoff.sh
Last active August 27, 2022 17:33
Turn off LEDs on a Lenovo p72
# echo version, requires sudo
echo 0 off > /proc/acpi/ibm/led # power button led
echo 10 off > /proc/acpi/ibm/led # lid led
echo 0 > /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness # mic mute led
echo 0 > /sys/devices/platform/thinkpad_acpi/leds/platform::mute/brightness # mute led
echo 0 > /sys/devices/pci0000:00/0000:00:14.3/leds/phy0-led/brightness # wifi led
# echo version with sudo
sudo bash -c "
echo 0 off > /proc/acpi/ibm/led # power button led
@MarkWalters-dev
MarkWalters-dev / watchyt.py
Created February 25, 2021 17:09
Qutebrowser userscript. Allows you to download and watch a youtube video
#!/usr/bin/env python
# coding=utf-8
"""
Description: Qutebrowser userscript. Allows you to download and watch a youtube video
Keyboard binding: config.bind("\\", 'hint all userscript watchyt.py')
Config file location: ~/.config/qutebrowser/config.py
Script file location: ~/.local/share/qutebrowser/userscripts/watchyt.py
Manually set keybinding: :bind \ hint all userscript watchyt.py
Usage: Press \ then the hint keys for the video you wish to watch.
You must select the video title not the image
@MarkWalters-dev
MarkWalters-dev / PKGBUILD
Last active February 24, 2021 16:11
PKGBUILD for apt
# Maintainer: Moses Narrow <moe_narrow@use.startmail.com>
# Co-Maintainer: Felix Golatofski <contact@xdfr.de>
# Contributor: Mark Weiman <mark.weiman@markzz.com>
# Contributor: Johannes Dewender arch at JonnyJD dot net
# Contributor: Tony Lambiris <tony@critialstack.com>
pkgbase=apt
pkgname=('apt' 'apt-docs')
pkgver=2.2.0
pkgrel=1
@MarkWalters-dev
MarkWalters-dev / urlqueue
Created February 13, 2021 04:24
A simple queue system written in bash
#!/usr/bin/env bash
# Parially copied from https://stackoverflow.com/questions/37318999/multiprocess-queue-in-bash
# Requires: nc, tee, grep, and bash
#
# Example usage:
# urlqueue -s
# urlqueue https://www.youtube.com/watch?v=J5cnM1ODU0Y
# urlqueue -q -p | while read -r URL # read until end of list
# do
# youtube-dl $URL
@MarkWalters-dev
MarkWalters-dev / reposetup
Created January 22, 2021 06:37
Setup repo that works with mkosi so you can install while offline
#!/usr/bin/env bash
# Run this from inside a repo container
# After starting your repo with "machinectl start repo" you can create new containers offline using:
# mkosi -d centos_epel -r 8 --mirror=http://centos.repo.lan --hostname=cheese -o /var/lib/machines/cheese
# I have "10.1.1.2 centos.repo.lan" in /etc/hosts
# mkosi also needs to be manually patched to disable gpg checking. No flag for it as of today.
# Also no usable flags to disable all repos. --repositories='!*' does not work yet.
# So I have to make a lot of symlinks to prevent it from failing.
WEBROOT=/var/www/html
@MarkWalters-dev
MarkWalters-dev / .bashrc
Last active December 24, 2020 17:01
Log history after every command in multiple sessions
export BASHLOG=$HOME/.local/share/bashlog
[ -e "$BASHLOG" ] || mkdir -p $BASHLOG
[ -n "$TERM_SESSION_ID" ] || export TERM_SESSION_ID="$(uuidgen)"
export PROMPT_COMMAND='echo "$(printf "%(%F.%H:%M:%S)T\n") $TERM_SESSION_ID $PWD $(history 1)" >> $BASHLOG/$(printf "%(%F)T\n").log'
@MarkWalters-dev
MarkWalters-dev / crxdl
Created March 14, 2020 01:57
Download chrome extension and extract it
#!/usr/bin/env bash
# pip has 2 options for downloading chrome extensions. cedl and chrome-webstore-download
# cedl has a more recent update than chrome-webstore-download
# but cedl polutes ~/bin by downloading to ~/bin/chrome-extensions so it is not an option without fixing that anti-feature
# chrome-webstore-download downloads to the current directory but requires -u|--url which is annoying but has the
# option to save to a custom filename with -f|--file which could come in handy
#
# This little script uses chrome-webstore-download to download and extract a chrome extension
#
# Example: crxdl https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf