Skip to content

Instantly share code, notes, and snippets.

View buchireddy's full-sized avatar

Buchi Reddy Busi Reddy buchireddy

View GitHub Profile
@buchireddy
buchireddy / docker_commands.sh
Created September 22, 2016 17:51
Some useful docker commands for developers.
# To create docker machine with more CPU and Memory power on Mac.
docker-machine create \
--driver virtualbox \
--virtualbox-cpu-count 4 \
--virtualbox-memory 4096 \
default
@buchireddy
buchireddy / beautify_json_file.py
Created February 13, 2016 01:22
Beautify a JSON file with python
import simplejson as json
obj = None
with open('file.json') as f:
obj = json.load(f)
outfile = open('file.json', "w")
outfile.write(json.dumps(obj, indent=4, sort_keys=True))
outfile.close()
@buchireddy
buchireddy / modify_sudoers_for_requiretty.sh
Created October 23, 2015 23:45
Shell script to modify the /etc/sudoers file and give sudo permissions for a user and also to turn requiretty off.
# Take a backup of sudoers file and change the backup file.
sudo cp /etc/sudoers /tmp/sudoers.bak
sudo echo "$USER ALL=(ALL) NOPASSWD:ALL
Defaults:$USER !requiretty
" >> /tmp/sudoers.bak
# Check syntax of the backup file to make sure it is correct.
sudo visudo -cf /tmp/sudoers.bak
if [ $? -eq 0 ]; then
# Replace the sudoers file with the new only if syntax is correct.
#!/usr/local/bin/env python
__author__ = 'buchi.busireddy'
from optparse import OptionParser
import hashlib
import os
import time