Commit 5285b732 by Fred Smith

old files I don't use

parent af05b0c7
#! /bin/bash
#! /usr/bin/env bash
cat ~/.ssh/header.cfg > ~/.ssh/config
echo '' > ~/.aws/credentials
......
#! /bin/bash
#! /usr/bin/env bash
DEBUG="false"
function usage {
echo "$0 - $VERSION (2012 - fred.smith@fredsmith.org)";
......
#!/usr/bin/env bash
#
# spark
# https://github.com/holman/spark
#
# Generates sparklines for a set of data.
#
# Here's a a good web-based sparkline generator that was a bit of inspiration
# for spark:
#
# https://datacollective.org/sparkblocks
#
# spark takes a comma-separated list of data and then prints a sparkline out of
# it.
#
# Examples:
#
# spark 1 5 22 13 53
# # => ▁▁▃▂▇
#
# spark 0 30 55 80 33 150
# # => ▁▂▃▅▂▇
#
# spark -h
# # => Prints the spark help text.
# Prints the help text for spark.
help()
{
cat <<EOF
USAGE:
spark [-h] VALUE,...
EXAMPLES:
spark 1 5 22 13 53
▁▁▃▂█
spark 0,30,55,80,33,150
▁▂▃▄▂█
echo 9 13 5 17 1 | spark
▄▆▂█▁
EOF
}
# Generates sparklines.
#
# $1 - The data we'd like to graph.
spark()
{
local n numbers=
# find min/max values
local min=0xffffffff max=0
for n in ${@//,/ }
do
# on Linux (or with bash4) we could use `printf %.0f $n` here to
# round the number but that doesn't work on OS X (bash3) nor does
# `awk '{printf "%.0f",$1}' <<< $n` work, so just cut it off
n=${n%.*}
(( n < min )) && min=$n
(( n > max )) && max=$n
numbers=$numbers${numbers:+ }$n
done
# print ticks
local ticks=(▁ ▂ ▃ ▄ ▅ ▆ ▇ █)
local f=$(( (($max-$min)<<8)/(${#ticks[@]}-1) ))
(( f < 1 )) && f=1
for n in $numbers
do
echo -n ${ticks[$(( ((($n-$min)<<8)/$f) ))]}
done
echo
}
# show help for no arguments if stdin is a terminal
if ([ -z $1 ] && [ -t 0 ]) || [ "$1" == '-h' ]
then
help
exit
fi
spark ${@:-`cat`}
#! /bin/bash
LONG="false";
if [[ "$1" -eq "" ]]; then
ZIPCODE="01720";
else
ZIPCODE="$1";
LONG="true";
fi
LINECOUNT="0";
curl -s "http://www.google.com/ig/api?weather=$ZIPCODE" | sed -e 's/.*city/city/' -e 's/\/>/\n/g' | grep -e 'city' -e '<condition data' -e '<temp_f' -e 'high' -e 'day_of_week' | cut -f 2 -d '"' |
while read LINE; do
LINECOUNT=$(( $LINECOUNT + 1));
#echo -n "$LINE ";
if [ $LINECOUNT -eq 1 ]; then
export CITY=$LINE;
elif [ $LINECOUNT -eq 2 ]; then
export CONDITIONS=$LINE;
elif [ $LINECOUNT -eq 3 ]; then
export TEMP=$LINE;
elif [ $LINECOUNT -eq 4 ]; then
export DAY1=$LINE;
elif [ $LINECOUNT -eq 5 ]; then
export DAY1TEMP=$LINE;
elif [ $LINECOUNT -eq 6 ]; then
export DAY1COND=$LINE;
elif [ $LINECOUNT -eq 7 ]; then
export DAY2=$LINE;
elif [ $LINECOUNT -eq 8 ]; then
export DAY2TEMP=$LINE;
elif [ $LINECOUNT -eq 9 ]; then
export DAY2COND=$LINE;
elif [ $LINECOUNT -eq 10 ]; then
export DAY3=$LINE;
elif [ $LINECOUNT -eq 11 ]; then
export DAY3TEMP=$LINE;
elif [ $LINECOUNT -eq 12 ]; then
export DAY3COND=$LINE;
elif [ $LINECOUNT -eq 13 ]; then
export DAY4=$LINE;
elif [ $LINECOUNT -eq 14 ]; then
export DAY4TEMP=$LINE;
elif [ $LINECOUNT -eq 15 ]; then
export DAY4COND=$LINE;
$LONG && echo "$CITY - $TEMP' - $CONDITIONS ----- $DAY1: $DAY1COND $DAY1TEMP', $DAY2: $DAY2COND $DAY2TEMP', $DAY3: $DAY3COND $DAY3TEMP'" || echo "$TEMP' - $CONDITIONS";
fi
done;
# Acton, MA
#Overcast
#40
#Fri
#52
#Chance of Storm
#Sat
#59
#Mostly Sunny
#Sun
#72
##Clear
#Mon
#79
#Partly Sunny
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment