Instantly share code, notes, and snippets.

View Example search page iterative searching algorithm
var searchBox = document.getElementById('search-field');
var searchButton = document.getElementById('search-button');
var i;
if (localStorage['i'] === undefined) {
localStorage['i'] = 0;
} else {
var i = localStorage['i'];
i++;
View check_power
echo ""
echo "${fg_cyan}Power Status: ${reset}"
upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"
echo "${fg_red}${bold}Current Discharge Rate: ${reset}"
awk '{print $1*10^-6 " W"}' /sys/class/power_supply/BAT0/power_now
echo ""
View working.sh
# Days on the Job
echo "${fg_magenta}Employement"
echo " ${fg_cyan}Days${reset}:" $(( ($(date +%s) - $(date --date="170905" +%s) )/(60*60*24) ))
echo " ${fg_cyan}Weeks${reset}:" $(( ($(date +%s) - $(date --date="170905" +%s) )/(60*60*24*7) ))
echo ""
View chkip.sh
#!/bin/bash
# check network interface's default gateways from route; useful when running VPNs
route | grep 'default' | awk ' {print $2}'
View filetypes
#!/bin/bash
# prints the filetypes (or extensions) of all of the available files in the
# current directory
# capture name of operating environment
os=$(uname -s)
# verify: which operating environment is being used
case "$os" in
Linux) . /usr/bin/tputs.clr
View convert2
#!/bin/bash
# conversion script
# store: number to work on
n=$2
# verify: amount of arguments after command
if [ $# -lt 2 ]; then
echo "[usage] $0 convert2"
exit
View xbutton1.ahk
#NoEnv ; Prevent empty variables from being interpreted
#Persistent ; Keep script operational
#SingleInstance ; Prevent script from initiating multiple instances
sysUser := "tinyMonkey"
devFile := "C:\Users\%tinyMonkey%\Documents\Development\Programs"
Menu, Tray, Icon, %A_ScriptDir%\icons\xbutton.ico
Menu, Main, Add, Button, xButtonMenu
View ansi.clr
#!/bin/bash
# ansi colors and text mode attributes
### COLORS ###
## Foreground
# Regular
fg_black='[30m' # 30 Black
fg_red='[31m' # 31 Red
fg_green='[32m' # 32 Green
fg_yellow='[33m' # 33 Yellow
View tputs.clr
#!/bin/bash
# tputs colors and text mode attributes
### COLORS ###
## Foreground
fg_black=`tput setaf 0` # 0 Black
fg_red=`tput setaf 1` # 1 Red
fg_green=`tput setaf 2` # 2 Green
fg_yellow=`tput setaf 3` # 3 Yellow
fg_blue=`tput setaf 4` # 4 Blue
View gitm
#!/bin/bash
# simplifies various git commands
# save: name of operating environment
os=$(uname -s)
# verify: which operating environment is being used
case "$os" in
Linux) . /usr/bin/tputs.clr
echo "${fg_cyan}[tputs]${reset} loaded! for Linux!" # [LINUX]