Skip to content

Instantly share code, notes, and snippets.

View arttuladhar's full-sized avatar

Aayush Tuladhar arttuladhar

View GitHub Profile
@arttuladhar
arttuladhar / gist:5579300
Created May 14, 2013 20:35
Extending Classes - Java Tuts
package com.aayushtuladhar.HelloWorld;
class B {
protected int x;
int getX() { return x; }
void setX(int x) { this.x = x; }
void increase() { x = x+1; }
void decrease() { x = x-1; }
int returnx() { return x; }
@arttuladhar
arttuladhar / InstallScript.sh
Created May 31, 2013 18:54
Using Expect Script
#!/usr/bin/expect
#Aayush Tuladhar
#Usage ./splunk_install.sh servername
#Setting Variable
set server [lrange $argv 0 0]
spawn scp file.txt splunk@$server:/home/asadmin/testfile.txt
expect {
-re "RSA key fingerprint" {send "yes\r"}
@arttuladhar
arttuladhar / install_ec2.sh
Last active May 6, 2023 03:04
Installing tmux on EC2
# Installing tmux on Amazon-EC2
# If you don't have libevent install use wget to install the libevent and install
wget https://github.com/downloads/libevent/libevent/libevent-2.0.18-stable.tar.gz
tar zxf libevent-2.0.18-stable.tar.gz
sudo ./configure & sudo make install
# If you don't have curses install use yum to install the curses
@arttuladhar
arttuladhar / .vimrc
Last active December 19, 2015 02:28
vimrRC for Getting Stuffs Done [VIM on Steroids] Basic VIM optimization + Few Common Mappings
"""""""""""""
" Basics
""""""""""""
syntax on
set background=dark
set ruler " Show the line number on the bar
set showmatch " Show matching parenthesis
set more " Use more prompt
set autoread " Watch for file changes
@arttuladhar
arttuladhar / git_brushup.md
Last active September 1, 2022 13:30
Basic GIT Commands for everyday use.

List of super userful Git Commands to use everyday.

Config / Setup

# Setting Global Username/Email
git config --global user.name "Aayush Tuladhar"'
git config --global user.email "aayush.tuladhar@gmail.com"'

# Clone a Repo from URL
@arttuladhar
arttuladhar / Convert.java
Created June 28, 2013 20:37
Converts resultSet to HashMap of Strings and Objects
/**
* <h2> Converts ResultSet to HashMap of List<String,Object></h2>
* @param row
* @param rs_SubItemType
* @throws SQLException
*/
private static void getHashMap( List<Map<String, Object>> row, ResultSet rs_SubItemType) throws SQLException {
ResultSetMetaData metaData = rs_SubItemType.getMetaData();
@arttuladhar
arttuladhar / troubleshoot_linux.md
Last active February 13, 2023 02:57
Linux Server Troubleshooting

Linux Server Troubleshooting

This will show who is logged on and what they are doing.

w

Check active processes are running

ps aux
@arttuladhar
arttuladhar / runremote.sh
Created July 10, 2013 15:16
Expect Script to run command on remote server
#!/usr/bin/expect -f
#Expect Script to Run Command on Remote Server
#Usage : ./test.sh <password> <servername> <username>
#Usage : ./test.sh password myserver user
#Set your command you want to run
set command "cat /etc/hosts | grep -i"
@arttuladhar
arttuladhar / everyday.sh
Last active February 2, 2018 17:32
Everyday Used Linux Commands
##############
#File Commands
##############
ls # - Directory Listing
ls -al # - Formatted listing with hidden files
cd dir # - Change directory to dir
pwd # - Print Working Directory (Show Current Directory)
mkdir dir # - Create a Directory dir
rm file # - Delete File
@arttuladhar
arttuladhar / install_essentials.sh
Last active February 27, 2021 18:35
Linux Install Essentials
#Install Updates and Upgrades
sudo apt-get update && sudo apt-get upgrade
# Installing Apache2
sudo apt-get install apache2 -y
#Install Build Essential packages
sudo apt-get install build-essential
#Nautilus Open Terminal