Skip to content

Instantly share code, notes, and snippets.

View arttuladhar's full-sized avatar

Aayush Tuladhar arttuladhar

View GitHub Profile
@arttuladhar
arttuladhar / .bash_profile
Created November 28, 2018 19:42
Dot Files
export PATH="$PATH:/usr/local/confluent-4.0.0/bin"
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export NVM_DIR="/Users/art/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
## Colorize the ls output ##
alias ls='ls -GFph'
@arttuladhar
arttuladhar / connect.sh
Created November 28, 2018 19:20
SSH Script to Log Into Siteground Server
# Adding Key
ssh-add private_key
# Logging In
ssh jaydynbl@jaydynblairphotography.com -p18765
@arttuladhar
arttuladhar / AppExecutors.java
Created July 24, 2018 20:24
Global executor pools for the whole application. Grouping tasks like this avoids the effects of task starvation (e.g. disk reads don't wait behind webservice requests).
public class AppExecutors {
// For Singleton instantiation
private static final Object LOCK = new Object();
private static AppExecutors sInstance;
private final Executor diskIO;
private final Executor mainThread;
private final Executor networkIO;
private AppExecutors(Executor diskIO, Executor networkIO, Executor mainThread) {
@arttuladhar
arttuladhar / DoublyLinkedList.java
Last active July 22, 2018 04:52
LinkedList DataStructure in Java
package com.art.datastructures;
import java.util.NoSuchElementException;
public class DoublyLinkedList<T> {
Node head;
DoublyLinkedList() {
this.head = null;
package com.art.designpatterns.strategy;
import com.google.common.collect.Lists;
import java.util.List;
public class StrategyDemo {
public static void main(String[] args) {
PromotionStrategy halfOffPromo = new HalfOffPromotionStrategy();
PromotionStrategy clearancePromo = new ClearancePromotionStrategy();
@arttuladhar
arttuladhar / CompositionDemo.java
Created July 16, 2018 22:38
Composition Demo
package com.art.fundamentals;
public class CompositionDemo {
public static void main(String[] args) {
Question firstQuestion = new Question("Who won 2018 World Cup ?", "France", "Croatia");
Question secondQuestion = new Question("Who hosted 2018 World Cup ?", "Russia", "USA");
System.out.println(firstQuestion);
System.out.println(secondQuestion);
@arttuladhar
arttuladhar / AggregationDemo.java
Last active July 17, 2018 04:17
Aggregation Demo
package com.art.fundamentals;
public class AggregationDemo {
public static void main(String[] args) {
Engine dohc_v6 = new Engine("3.0L TFSI Supercharged DOHC V-6", "2014", "Audi");
Car myCar = new Car(dohc_v6, "Audi A6");
// Car Info
System.out.println(myCar.toString());
myCar = null;
@arttuladhar
arttuladhar / Duck.java
Created July 16, 2018 00:31
Adapter Design Pattern Example
package com.art.head_first.turkeyadapter;
public interface Duck {
public void quack();
public void fly();
}
@arttuladhar
arttuladhar / ChocolateBoiler.java
Created July 15, 2018 22:56
Singleton Design Pattern Example
package com.art.head_first.chocolateboiler;
class ChocolateBoiler {
private static ChocolateBoiler uniqueInstance;
private boolean empty;
private boolean boiled;
private ChocolateBoiler() {
@arttuladhar
arttuladhar / Command.java
Created July 14, 2018 04:10
Command Design Pattern Example
package com.art.head_first.homeautomation;
public interface Command {
void execute();
void undo();
}