grep -lr '<<<<<<<' . | xargs git checkout --ours
OR
grep -lr '<<<<<<<' . | xargs git checkout --theirs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set the Forward Delete key to delete a file in Finder | |
defaults write com.apple.finder NSUserKeyEquivalents '{"Move to Trash"="\U007F";}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo visudo | |
antonio ALL = (ALL) NOPASSWD: /bin/fixtime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# kp 3000 node # kill if node is running on port 3000 | |
# kp 3000 # kill process running on port 3000 | |
PORT=$1; | |
MATCH=$2; | |
if [ -n "$MATCH" ]; then | |
kill -9 `lsof -i :$PORT | awk -v MATCH=$2 '$0 ~ MATCH{ print $2; }'` | |
exit; | |
fi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const value = num | |
.replace(/[^\d]/gm, '') | |
.replace(/^(\d\d)([^ ]+)$/, '($1) $2') | |
.replace(/(\(\d\d\)) (\d{5})(\d)$/, '$1 $2-$3') | |
.replace(/(\(\d\d\)) (\d{4})(\d{1,5})$/, '$1 $2-$3') | |
.replace(/(\(\d\d\)) (\d{4})-(\d)(\d{4})$/, '$1 $2$3-$4') | |
.replace(/(\(\d\d\)) (\d{5})(\d{4})(.*)/, '$1 $2-$3') |
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf
File locations:
nginx.conf
to/usr/local/etc/nginx/
default.conf
anddefault-ssl.conf
to/usr/local/etc/nginx/sites-available
homebrew.mxcl.nginx.plist
to/Library/LaunchDaemons/
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
OlderNewer