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 / ssh_tunneling.md
Last active August 28, 2024 14:17
ssh tunneling and port forwarding

###Single hop tunelling:

ssh -f -N -L 9906:127.0.0.1:3306 user@dev.example.com

where,

  • -f puts ssh in background
  • -N makes it not execute a remote command
@ashrithr
ashrithr / kerberos_setup.md
Last active August 2, 2024 02:34
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 / kafka.md
Last active March 14, 2024 21:16
kafka introduction

Introduction to Kafka

Kafka acts as a kind of write-ahead log (WAL) that records messages to a persistent store (disk) and allows subscribers to read and apply these changes to their own stores in a system appropriate time-frame.

Terminology:

  • Producers send messages to brokers
  • Consumers read messages from brokers
  • Messages are sent to a topic
@ashrithr
ashrithr / port_open.rb
Last active December 18, 2023 15:15
check if port is open on a remote host
#!/usr/bin/env ruby
require 'socket'
require 'timeout'
unless ARGV.length == 2
abort "Usage: ruby #{__FILE__} HOST PORT"
end
def port_open?(ip, port, seconds=1)
# => checks if a port is open or not on a remote host
Timeout::timeout(seconds) do
@ashrithr
ashrithr / os_info.sh
Created June 10, 2013 22:18
Detect OS info
#!/bin/bash
# Detects which OS and
# if it is Linux then it will detect which Linux Distribution,
# if Mac(Darwin) will detect mac os x version, build number
OS=`uname -s`
REV=`uname -r`
MACH=`uname -m`
GetVersionFromFile()
@ashrithr
ashrithr / A_maven.md
Last active October 11, 2023 08:45
build java projects using maven

Intro to Maven

###Create a project from Maven Template:

To start a new maven project, use the maven archetype plugin from the command line using the archetype:generate goal.

The following command will tell maven to create a java project from maven-archetype-quickstart template, if you ignore the archetypeArtifactId argument, then a list of the templates will be listed for you to choose.

@ashrithr
ashrithr / RandomHttpLogGen.scala
Last active September 20, 2023 21:00
Scala script to generate random http log events to a output file specified, one can specify the number of events to generate per second. Also, class IPGenerator can take in number of sessions and session length which can be used to simulate a user returning back.
#!/bin/sh
exec scala -savecompiled "$0" "$@"
!#
import scala.collection.mutable.Map
import scala.util.Random
import scala.collection.mutable.ArrayBuffer
import java.io._
class IPGenerator(var sessionCount: Int, var sessionLength: Int) {
@ashrithr
ashrithr / FIleSystemOperations.java
Created February 26, 2015 01:27
HDFS FileSystems API example
package com.cloudwick.mapreduce.FileSystemAPI;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@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 / buildScalaProject.sh
Last active November 18, 2022 08:24
creates scala project structure using sbt 0.13
#!/bin/bash
function usage () {
script=$0
cat <<USAGE
Creates scala project structure to be used with sbt
Syntax
`basename $script` project_name artifact_id