Skip to content

Instantly share code, notes, and snippets.

View xunlao's full-sized avatar

X. Lumi. xunlao

View GitHub Profile
@xunlao
xunlao / launch_app_based_on_environment.sh
Last active June 15, 2020 05:04
Launch App based on if some website is accessible or not (i.e. in company network or at home)
# https://stackoverflow.com/questions/22009364/is-there-a-try-catch-command-in-bash
echo "checking the network work/home.."
sleep 5;
{ # try
curl www.vmware.com && { # need to wrap using {}
echo "try pass; open working app"
open "/Applications/Microsoft Outlook.app/"
open "/Applications/Firefox.app/"
}
@xunlao
xunlao / gtimereport_form_filler.js
Created February 6, 2017 05:39
gtimereport_form_filler.js
javascript:(function () {
var date = new Date();
var todayStr = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
$("#PeriodStart").val(todayStr);
$("#PeriodEnd").val(todayStr);
/* The items to choose */
$("input")[3].checked = 'checked';
$("input")[4].checked = 'checked';
$("input")[5].checked = 'checked';
$("#ShowSummary")[0].checked = 'checked';