Skip to content

Instantly share code, notes, and snippets.

View nitinsatish's full-sized avatar
🎯
Focusing

Nitin nitinsatish

🎯
Focusing
View GitHub Profile
@nitinsatish
nitinsatish / apach-up.sh
Created January 13, 2012 10:57
Apache upgrade script
#!/bin/bash
#script to upgrade Apache web server
/usr/local/apache2/bin/httpd -v
echo "Upgrade apache ? [y/n]"
read ans
if [ "$ans" = "y" ]
then
echo -e "\n Backing up Apache dir \n"
cp -pr /usr/local/apache2 /usr/local/apache2-`date +%F`.bk
tar -zxvf httpd-2.2.*.tar.gz
@nitinsatish
nitinsatish / parse_arg.py
Created January 14, 2012 16:19
python argument parser
#!/usr/bin/python
import sys
def getopt(args):
if len(args)>1:
opts={}
while (args):
if args[0][0]=='-':
opts[args[0]]=args[1]
args=args[2:]
else:
@nitinsatish
nitinsatish / oneliners.txt
Created January 21, 2012 06:32
One liners
awk 'BEGIN { RS="}" } { for(i=1;i<=NF;i++) if ($i~"192.168") print $2,$i }' /etc/dhcpd.conf|sed 's/;//g'|sort -n -t. -k4
@nitinsatish
nitinsatish / nagios-setup.sh
Last active March 2, 2018 22:25
Nagios Installer
#!/bin/bash
echo "Installing nagios-plugin"
cd nagios-plugins*
./configure --with-openssl=/usr/bin --with-mysql=/usr
make
make install
useradd nagios -G script
chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec
@nitinsatish
nitinsatish / largest_file.py
Created January 27, 2012 18:15
Find the largest file of given extension in a directory
#!/usr/bin/python
import os, sys
if len(sys.argv)==1 :
folder='.'
else :
folder=sys.argv[1]
if len(sys.argv)==3 :
@nitinsatish
nitinsatish / ips-available.py
Created July 14, 2013 08:31
Find Free IP addresses from DHCP configuration file.
#!/usr/bin/python
import re
config_file='/etc/dhcpd.conf'
ips_used=[]
not_used=[]
try :
dhcp_config=open(config_file,'r')
for lin in dhcp_config :
match=re.search(r'^fixed-address\ \d+\.\d+\.\d+\.(\d+);',lin)
@nitinsatish
nitinsatish / puppet_issues.md
Last active June 18, 2018 08:41
[Puppet Errors] common ones #puppet

Splunk error: Error 400 on SERVER: comparison of String with Float failed

  • Check and correct the redhat release
rm -f /etc/redhat-release
ln -s /etc/centos-release /etc/redhat-release
  • Check node defination matches hostname
  • Check facter hostname correct
@nitinsatish
nitinsatish / nginxproxy.md
Created August 26, 2019 11:14 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

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

@nitinsatish
nitinsatish / System Design.md
Created December 15, 2019 10:10 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@nitinsatish
nitinsatish / System Design.md
Created December 15, 2019 10:10 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?