Skip to content

Instantly share code, notes, and snippets.

View richarddewit's full-sized avatar
🗿
〰️〰️〰️〰️

Kerani richarddewit

🗿
〰️〰️〰️〰️
View GitHub Profile
@richarddewit
richarddewit / _pre-commit-check-console-log.sh
Last active June 26, 2019 08:55 — forked from svschannak/gist:8d1a445a751d5ae8e18ef9b98a45be9f
Git pre-commit hook that detects if the developer forget to remove all the javascript console.log before commit.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='^\+.*console\.log('
# CHECK
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0
then
@richarddewit
richarddewit / hostsmanager.sh
Last active March 8, 2019 00:24 — forked from irazasyed/manage-etc-hosts.sh
Bash script to manage /etc/hosts file, adding/removing hostnames.
#!/usr/bin/env bash
if [ "$1" != "add" ] && [ "$1" != "remove" ] || [ -z "$2" ]; then
[ -z "$2" ] && echo "Missing hostname" || echo "Unknown option '$1'"
echo "Unknown option '$1'"
echo "Usage:"
echo " $0 add <hostname>"
echo " $0 remove <hostname>"
exit 1
fi
@richarddewit
richarddewit / vagrant-sudoers-arch-fedora.sh
Last active January 2, 2019 07:27 — forked from elvetemedve/Arch Linux, Fedora
Allow Vagrant usage without providing sudo password
#
# Arch Linux / Fedora sudoers entries
#
sudo tee /etc/sudoers.d/vagrant > /dev/null << EOL
# Allow passwordless startup of Vagrant with vagrant-hostsupdater.
Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts
Cmnd_Alias VAGRANT_HOSTS_REMOVE = /usr/bin/sed -i -e /*/ d /etc/hosts
%wheel ALL=(root) NOPASSWD: VAGRANT_HOSTS_ADD, VAGRANT_HOSTS_REMOVE