From 994f3b83208caa943032b7012c886069878856fa Mon Sep 17 00:00:00 2001 From: Ian Keane Date: Tue, 7 Jun 2022 15:44:19 -0400 Subject: [PATCH] Add home/bin folder --- slackware/bin/jbrowse | 1 + slackware/bin/notifyme | 1 + slackware/bin/prune_local_branches | 3 ++ slackware/bin/sugar | 76 ++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100755 slackware/bin/jbrowse create mode 100755 slackware/bin/notifyme create mode 100755 slackware/bin/prune_local_branches create mode 100755 slackware/bin/sugar diff --git a/slackware/bin/jbrowse b/slackware/bin/jbrowse new file mode 100755 index 0000000..612416d --- /dev/null +++ b/slackware/bin/jbrowse @@ -0,0 +1 @@ +/Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser "https://everblue.atlassian.net/browse/"$1 & diff --git a/slackware/bin/notifyme b/slackware/bin/notifyme new file mode 100755 index 0000000..3ea60b9 --- /dev/null +++ b/slackware/bin/notifyme @@ -0,0 +1 @@ +osascript -e 'display notification "done!" with title "Notification"' diff --git a/slackware/bin/prune_local_branches b/slackware/bin/prune_local_branches new file mode 100755 index 0000000..817f611 --- /dev/null +++ b/slackware/bin/prune_local_branches @@ -0,0 +1,3 @@ +#!/bin/bash + +git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -r -n 1 git branch -D diff --git a/slackware/bin/sugar b/slackware/bin/sugar new file mode 100755 index 0000000..5dc7f42 --- /dev/null +++ b/slackware/bin/sugar @@ -0,0 +1,76 @@ +#!/usr/local/bin/python3 +import sys +import requests +import json +from termcolor import colored + +# sample request: + +# [ +# { +# "_id": "629672ecb982f4a1be3a7dd6", +# "device": "xDrip-DexcomG5", +# "date": 1654026986232, +# "dateString": "2022-05-31T19:56:26.232Z", +# "sgv": 185, +# "delta": 0.996, +# "direction": "Flat", +# "type": "sgv", +# "filtered": 0, +# "unfiltered": 0, +# "rssi": 100, +# "noise": 1, +# "sysTime": "2022-05-31T19:56:26.232Z", +# "utcOffset": -240, +# "mills": 1654026986232 +# } +# ] + +tmux = '--tmux' in sys.argv + +down = '\u2193' # ↓ +falling = '\u2798' # ➘ +flat = '\u2192' # → +rising = '\u279a' # ➚ +up = '\u2191' # ↑ + +url = 'http://blood.dump.town' +options = '/api/v1/entries.json?count=1&token=phone-7631d7eebc79825b' + +res = requests.get(url + options) +sugar = res.json()[0] + +delta = sugar['delta'] +sgv = sugar['sgv'] +direction = sugar['direction'] + +if delta < -10: + arrow = down +if delta >= -10 and delta < -1: + arrow = falling +if delta >= -1 and delta <= 1: + arrow = flat +if delta > 1 and delta <= 10: + arrow = rising +if delta > 10: + arrow = up + +if (sgv >= 225 or sgv <= 80): + color = 'red' +elif ((sgv >= 180 and sgv <= 225) + or (sgv <= 100 and sgv >= 80)): + color = 'yellow' +else: + color = 'green' + +if not tmux: + print(colored(str(sugar['sgv']) + + ' ' + arrow + ' ' + + '(' + str(delta) + ')', + color)) +else: + print(f'#[bg={color}] ' + + str(round(sugar['sgv'], 1)) + ' ' + + arrow + ' ' + + '(' + str(delta) + ')' + )