Skip to content

Instantly share code, notes, and snippets.

@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"
@jjrh
jjrh / tab_windows.sh
Created July 12, 2016 16:19
will tab through all the windows labled as work1 (or what ever label you like)
#!/bin/bash
# usage:
# tab_windows.sh work1
# will tab through all the windows labled as work1 (or what ever label you like)
# certainly overly complicated code but i'm tired
#wmctrl -i -a "$WINDOWID" # and go back to the terminal that called this.
#echo ${arrList[@]} >> ~/tmp/tab_dump # whole array
@jjrh
jjrh / jump_remember.sh
Last active July 12, 2016 16:16
Remembers a window or jumps to a remembered window.
#!/bin/bash
# Author: Justin Hornosty (jjrh)
# Date: 2015-10-08
#
# jump_remember.sh
# ---------------------------
# desc:
# Remembers a window or jumps to a remembered window.
#
# usage:
@jjrh
jjrh / rc.xml
Created July 12, 2016 16:12
my openbox rc.xml
<openbox_config xmlns="http://openbox.org/3.4/rc">
<resistance>
<strength>10</strength>
<screen_edge_strength>20</screen_edge_strength>
</resistance>
<focus>
<focusNew>yes</focusNew>
<!-- always try to focus new windows when they appear. other rules do
apply -->
#!/bin/bash
sleep_for_time() {
c=0
printf "\0337"
while [ $c -le $1 ]; do
# printf "\0337"
printf "\0338"
@jjrh
jjrh / ws_norsecorp_map.py
Created February 27, 2016 19:28
connects to map.norsecorp.com via websockets and outputs the json data
# for fun...
# connects to the http://map.norsecorp.com/ websocket.
# displaying data would make for a fun wall display :)
#
# scraping this might be cool? http://www.gstatic.com/ddos-viz/attacks.json
# think this is just the rendered polygons - http://www.digitalattackmap.com/static/world-110m.json
#
import websocket
import json
/*
https://forum.pjrc.com/threads/31655-ASCII-art-Teensy-3-2-pinout
Teensy 3.2 Pinout - Top View
+-----+
+------------------------| USB |-----------------------+
| +-----+ |
| [ ]GND Vin(3.6-6.0v)[ ] |
| [ ]0/RX1(Touch) VUSB[ ] AGND[ ] |
@jjrh
jjrh / CND.sh
Created July 21, 2015 21:07
Gets the current value of the Canadian dollar.
#!/bin/bash
out=$(curl -s http://www.bankofcanada.ca/stats/assets/rates_rss/closing/en_USD_CLOSE.xml | grep CA: | cut -f2 -d '>' | cut -f1 -d '<' )
CND=$(echo $out | cut -f2 -d ' ')
echo \$1 USD = \$$CND CND
html {
font-size: 18px;
-webkit-tap-highlight-color: #000000;
}
body {
font-family: DOS, Monaco, Menlo, Consolas, "Courier New", monospace;
font-size: 18px;
line-height: 20px;
color: #bbbbbb;
background-color: #000084;