Skip to content

Instantly share code, notes, and snippets.

@trmsmy
trmsmy / ddb-kinesis-lambda.py
Created May 20, 2019 18:52 — forked from sasankmukkamala/ddb-kinesis-lambda.py
Send Existing Data from Dynamodb to AWS Lambda via Kinesis by scanning entire table.
import boto3
import boto3.dynamodb.types
import json
# Load the service resources in the desired region.
session = boto3.Session(profile_name='default')
dynamodb = session.resource('dynamodb', region_name="ap-south-1")
kinesis = session.client('kinesis', region_name="ap-south-1")
# Set names for ddb table and ks stream
@trmsmy
trmsmy / EchoTest.java
Created May 10, 2018 02:36 — forked from chbaranowski/EchoTest.java
Cheat Sheet Test for Mockito
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Mockito.*;
import static org.mockito.BDDMockito.*;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
@trmsmy
trmsmy / System Design.md
Created April 5, 2018 12:07 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@trmsmy
trmsmy / template-java-after.xml
Created March 6, 2018 16:25 — forked from mnuessler/template-java-after.xml
Templates for the Eclipse IDE
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="java-members" deleted="false" description="tear down after test" enabled="true" name="after">@${afterType:newType(org.junit.After)}
public void tearDown() throws Exception {
${cursor}
}</template></templates>
@trmsmy
trmsmy / SecurityConfig.java
Created March 2, 2018 15:53 — forked from yashpatil/SecurityConfig.java
Spring Security Java configuration for Pre-authenticated scenario
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDecisionVoter;
import org.springframework.security.access.vote.AffirmativeBased;
import org.springframework.security.access.vote.RoleVoter;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.ProviderManager;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
/**
* Custom submit directive that will only submit when all the validation has passed
* for all the fields. This extends on the ng-submit directive provided by AngularJS.
*
* This directive will also remove the 'pristine' flag from all the fields when
* hitting submit, allowing the form to display no errors until the submit button
* is clicked/enter is pressed.
*
* The variable 'app' is the instance of a module.
* E.g. var app = angular.module('my-app', []);