Skip to content

Instantly share code, notes, and snippets.

View antoniopresto's full-sized avatar

Antonio Silva antoniopresto

View GitHub Profile
@antoniopresto
antoniopresto / bestMatch.js
Created December 19, 2017 21:48
bestMatch.js
// find in objects https://www.npmjs.com/package/q_
function _(o, qs) {
const qa = qs.replace(/\[([0-9]*)]/gim, '.$1').split('.');
return qa.reduce(function(prev, next) {
if (!prev) return undefined;
return prev[next];
}, o);
}
function bestMatch(o, qs) {
# /bin/fixtime
/usr/sbin/ntpdate -u time.apple.com
#
chmod u+x /bin/fixtime
# cron
$ EDITOR=nano crontab -e
> 2 * * * * sudo -S fixtime >> ~/Desktop/cron.log 2>&1
$ sudo visudo
antonio ALL = (ALL) NOPASSWD: /bin/fixtime
# set the Forward Delete key to delete a file in Finder
defaults write com.apple.finder NSUserKeyEquivalents '{"Move to Trash"="\U007F";}'