Skip to content

Instantly share code, notes, and snippets.

View anjanashankar9's full-sized avatar

Anjana Shankar anjanashankar9

View GitHub Profile
type Employee struct {
firstName string
secondName string
id int
}
package main
import (
"fmt"
"reflect"
)
type Employee struct {
firstName string
secondName string
id int
package main
import (
"fmt"
"reflect"
)
type Employee struct {
firstName string
secondName string
id *int
public static void main(String[] args) {
Device device = new Television();
Remote remote = new Remote(device);
// Turn TV on
Command cmd = new TurnTVOn(device);
cmd.execute();
//Turn TV Off
cmd = new TurnTVOff(device);
public class Remote {
Device device;
public Remote(Device device) {
this.device = device;
}
}
public class TurnTVOn implements Command {
Device device;
public TurnTVOn(Device device) {
this.device = device;
}
@Override
public void execute() {
public interface Command {
public void execute();
}
@anjanashankar9
anjanashankar9 / Television.java
Created August 1, 2021 11:36
Command Pattern - TV
public class Television implements Device {
@Override
public void on() {
System.out.println("TV is on !!");
}
@Override
public void off() {
System.out.println("TV is off !!");
@anjanashankar9
anjanashankar9 / Device.java
Created August 1, 2021 11:35
Command Pattern - dev
public interface Device {
public void on();
public void off();
}
@anjanashankar9
anjanashankar9 / trust_policy.json
Created May 19, 2021 17:38
AWS - Role Based Access
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}