Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jjrh on github.
  • I am jjrh (https://keybase.io/jjrh) on keybase.
  • I have a public key ASAVD07uzmEi5HefAbduH11YBJ-1nHfTk1H-KkzNfcccsQo

To claim this, I am signing this object:

@jjrh
jjrh / stats.sh
Created March 19, 2020 15:53
show corona-stats from https://corona-stats.online every hour (change timedelay to be longer) ARG1 is country code. Empty arg is world stats. Ie: ./stats.sh CA
#!/bin/bash
x=1
inf=0
timedelay=3600
COUNTRY_CODE="$1"
while [ $inf -le 1 ]; do
clear
sleep 0.5
#!/bin/bash
# Author: Justin Hornosty (jjrh)
# Date: 2015-10-08
#
# jump_remember.sh
# ---------------------------
# desc:
# Remembers a window or jumps to a remembered window.
#
# usage:
#!/bin/bash
#####################################################################
#
# jjrh tab_by_class
# 2018-03-21
#--------------------------------------------------------------------
#
# tabs windows based on the windows class on the current desktop
# ex: tab_by_class emacs
@jjrh
jjrh / prosody_module_reload.js
Created April 14, 2017 23:12
reload a prosody module (or multiple modules)
var telnet = require('telnet-client');
var connection = new telnet();
var async = require('async');
var params = {
host: 'localhost',
port: 5582,
shellPrompt: '\ ',
timeout: 5500,
removeEcho: 4
};
@jjrh
jjrh / tintVert.sh
Created July 31, 2016 17:02
Start tint2 vertical config if it isn't running, if it's running kill it.
#!/bin/bash
EXIST=$(ps ax | grep "tint2_verticalrc" | grep -v grep)
if [ ${#EXIST} -eq 0 ]; then
tint2 -c ~/.config/tint2/tint2_verticalrc >>/dev/null 2> /dev/null &
else
kill $(echo $EXIST | cut -f1 -d ' ')
fi
@jjrh
jjrh / tintSwitch.sh
Created July 31, 2016 17:00
For swapping between a vertical config of tint2 and a horizontal config.
#!/bin/bash
getPID()
{
echo $1 | cut -f1 -d ' '
}
# create list of tint2 that are running
IFS=$'\n'
tints=( $(ps ax | grep tint2 | grep -v grep) )
@jjrh
jjrh / mpd_startup
Created July 12, 2016 16:26
checks if a program is running, if not, it tries to start it. # after 3 tries, if the program hasn't started we print out the error # and return.
#!/bin/sh
# checks if a program is running, if not, it tries to start it.
# after 3 tries, if the program hasn't started we print out the error
# and return.
errors=""
# uses pgrep to find the running process.
check_prog ()
@jjrh
jjrh / twork.sh
Created July 12, 2016 16:24
creates new tmux session with name (work) if it exists attach to it, if not create it.
#!/bin/bash
tmux list-sessions | grep work
if [ $? -ne 0 ]; then
tmux new-session -s work
else
tmux attach -twork -d
fi
@jjrh
jjrh / rename_window
Created July 12, 2016 16:22
changes title of window
#!/bin/bash
xterm -geometry 80x4 -bg red -fg white -T "Enter New window title" -e 'printf "Enter new title:"; read title ; printf "click target window....\n"; wmctrl -r :SELECT: -T "$title" -N "$title"