Skip to content

Instantly share code, notes, and snippets.

View moismailzai's full-sized avatar

Mo Ismailzai moismailzai

View GitHub Profile
#!/bin/bash -eux
# Add vagrant user to sudoers
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
# UseDNS no to `sshd_config`.
sed /UseDNS/d /etc/ssh/sshd_config > /tmp/sshd_config
echo "UseDNS no" >> /tmp/sshd_config
mv /tmp/sshd_config /etc/ssh/sshd_config
@moismailzai
moismailzai / vagrant-clean.sh
Last active September 3, 2018 08:28 — forked from jdowning/vagrant-clean.sh
Script to clean up Ubuntu Vagrant box before packaging
#!/bin/bash
# This script zeroes out any space not needed for packaging a new Ubuntu Vagrant base box.
# Run the following command in a root shell:
#
# bash <(curl -s https://gist.githubusercontent.com/moismailzai/0864e90d55d508ec8f5aa1ccd68887c6/raw/fdfd7b28bd00623311689a50754307b06e2e5922/vagrant-clean.sh)
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
@moismailzai
moismailzai / sphp.sh
Last active April 5, 2017 01:50 — forked from w00fz/sphp.sh
PHP switcher
#!/bin/bash
# Check if command was ran as root.
if [[ $(id -u) -eq 0 ]]; then
echo "The command \"sphp\" should not be executed as root or via sudo directly."
echo "When a service requires root access, you will be prompted for a password as needed."
exit 1
fi
# Usage
@moismailzai
moismailzai / package.json
Last active February 14, 2017 02:07
Prototype for transporting HTML via JSON
{
"html": {
"body": {
"_attributes": {
"_class": [
"container",
"flex"
]
},
"_children": {