Skip to content

Instantly share code, notes, and snippets.

@geolaw
geolaw / gist:246322b626b0b2b29d46dfa8f8e3e2c1
Last active January 20, 2023 17:24
macos volume adjustment with skhd
more from my linux i3wm -> macos conversion.
very used to being able to adjust my volume up and down or muted with a keystroke.
Note - using a standard generic keyboard, not an Apple keyboard, no special multimedia keys
2 bash scripts - could possibly combine them into one, but later ...
First to change the volume up and down.
~ cat bin/change_volume
@geolaw
geolaw / random_music.sh
Last active April 14, 2022 18:18
random music player. Randomizes $MUSIC dir and plays back in mpv
#!/bin/bash
# GEL (C) 2022
# work in progress
# randomizes music playback
IFS="$(printf '\n\t')"
MUSIC="/Music/Music"
cd $MUSIC
back_to_root=0
@geolaw
geolaw / sqlite_download.sh
Created April 12, 2022 12:09
watches sqlite urls.db db and downloads links with youtube-dl
#!/bin/bash
# video downloader. uses ~/urls.db as reference.
# seperate script watches the clip board for any http links and puts them in the
# table
# all downloads to /data/p/Downloads
cd /data/p/Downloads
while true; do
@geolaw
geolaw / watch_clipboard.sh
Created April 12, 2022 12:07
Watch xclip clipboard for http links, shove them into a sqlite database
#!/bin/bash -f
# capture URLS from the clipboard and push them into the urls sqlite db
while [ 1 ]; do
t=`xclip -o `
echo "clip board is $t"
echo $t | grep http > /dev/null
if [ "$?" == "0" ]; then
# query the database to see if its already there
@geolaw
geolaw / buffalo_nas.yml
Last active March 29, 2022 14:00
Ansible Playbook to install ipkg and unfsd on a buffalo linkstation
---
- name: checks NFS on my buffalo linkstation and installs ipkg and unfs3 if needed
hosts: buffalo
vars:
exports_src: files/etc/exports
exports_dest: /opt/etc/exports
tasks:
# - name: check for ipkg
# stat:
@geolaw
geolaw / simple_http.service
Created March 1, 2022 21:20
Simple systemd unit file for python http server
[Unit]
Description=http redirect
# simple web service to server a index.html with a meta refresh without having to do via apache/nginx
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
User=root # need root to bind to port 80
WorkingDirectory=/Downloads/html/ # directory containing a index.html with a meta refresh for redirect