Skip to content

Instantly share code, notes, and snippets.

View ashrithr's full-sized avatar
🎯
Focusing

Ashrith Mekala ashrithr

🎯
Focusing
View GitHub Profile
@ashrithr
ashrithr / users.sh
Created October 6, 2014 04:01
Linux users with password and currently logged in
#!/bin/bash
users_with_pwd=$(awk -F":" '!($2 == "" || $2 == "!!" || $2 == "*") {print $1}' /etc/shadow)
users_logged_in=$(who | awk '{print $1}' | uniq)
echo "[*] Users with password: "
for user in ${users_with_pwd}; do
echo $user
done
@ashrithr
ashrithr / ssh_quit.md
Created September 27, 2014 23:16
Close frozen ssh connection

[enter]~.

@ashrithr
ashrithr / recursion.scala
Last active August 29, 2015 14:06
Scala Recursions and Tail call optimization
import scala.annotation.tailrec
object fact {
// n! = n * (n-1) * (n-2) * ... * 2 * 1
// n! = if (n>1) n * (n-1)! else 1
def factorial(n: Int): Int =
if (n > 1)
n * factorial(n - 1)
else
@ashrithr
ashrithr / elk_puppet.md
Created September 15, 2014 08:59
Installing & Configuring logstash, elasticsearch, logstash-forwarder using Puppet

Install puppet server and clients

Puppet Server

curl -s https://raw.githubusercontent.com/cloudwicklabs/scripts/master/puppet_install.sh | bash /dev/stdin -s -a -v

Puppet Client

@ashrithr
ashrithr / oracle_jdk.sh
Last active August 22, 2016 05:02
wget oracle jdk
# RPM
wget --no-check-certificate \
--no-cookies \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.rpm \
-O jdk-7u45-linux-x64.rpm
# TAR GZ
wget --no-check-certificate \
--no-cookies \
@ashrithr
ashrithr / github_fork_update.md
Last active August 29, 2015 14:06
Updating github fork
  1. cd into the forked repository directory that you want to update

     cd repository_dir
    
  2. Add a new remote to point to the original repository

     git remote add upstream git://github.com/author/project.git
    
  3. Pull the new commits from the original repo

#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@ashrithr
ashrithr / readme.md
Last active December 7, 2022 01:47
Installing ELK on a single machine

Installing ELK (CentOS)

This is a short step-by-step guide on installing ElasticSearch LogStash and Kibana Stack on a CentOS environment to gather and analyze logs.

I. Install JDK

rpm -ivh https://dl.dropboxusercontent.com/u/5756075/jdk-7u45-linux-x64.rpm
@ashrithr
ashrithr / kerberos_setup.md
Last active March 19, 2024 16:20
Set up kerberos on Redhat/CentOS 7

Installing Kerberos on Redhat 7

This installation is going to require 2 servers one acts as kerberos KDC server and the other machine is going to be client. Lets assume the FQDN's are (here cw.com is the domain name, make a note of the domain name here):

  • Kerberos KDC Server: kdc.cw.com
  • Kerberos Client: kclient.cw.com

Important: Make sure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in

@ashrithr
ashrithr / iptables_rhel7.md
Created August 2, 2014 21:26
Enabling IPTables in RHEL/CentOS 7

Firewalld, if included in RHEL 7, is a replacement for iptables and is being included as default. Some benefits include not needing to restart the firewall when changes are made, which means your system maintains its firewall during rule modification, and current connections are not lost.

Anyhow, if you are not willing to migrate to Firewalld and want to use iptables as default, follow these steps:

Install iptables service:

yum install -y iptables-services