Skip to content

Instantly share code, notes, and snippets.

@getmetorajesh
getmetorajesh / cdk-notes.md
Last active April 22, 2020 03:42
AWS CDK Notes

Intro

CDK is wrapper on top of AWS Cloudformation that enables developers to infrastructure as code in programming languages(Typescript, Python etx)

Getting started

npm install -g aws-cdk

cdk --version

npx npm-check-updates -u
run aws cli command with --debug to see where the credentials are coming from
@getmetorajesh
getmetorajesh / hamming distance algo
Created August 23, 2019 07:22
Hamming distance
/*
* Hamming distance refers to the number of points at which two variables differ,
* calculated by simply adding up the number of spots where two variables differ.
* The variable can be binary or strings.
* Used for finding genetic distance or to find the no of distorted bits to estimate error
*/
const hammingDistance = (x, y) => {
let inc = 0
let count = 0
while (x[inc]) {
@getmetorajesh
getmetorajesh / gists_to_dash_db.rb
Created November 25, 2017 09:01 — forked from voising/gists_to_dash_db.rb
Connect Gists with Dash (Code Snippet Manager)
#!/usr/bin/env ruby
if ARGV[0].nil? || ARGV[0].match(/-h/)
puts "Usage : #{$0} github_username dash_sqlite_db char_appended_to_keyword [no_comments]"
exit
end
require 'net/http'
require 'open-uri'
#require 'awesome_print'
@getmetorajesh
getmetorajesh / ubuntu_agnoster_install.md
Created October 8, 2017 13:26 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@getmetorajesh
getmetorajesh / aws-sns-example.js
Created October 1, 2017 10:20 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@getmetorajesh
getmetorajesh / AkkaHttpApiFollowingJsonApiSpec.scala
Created June 17, 2017 09:08 — forked from jeroenr/AkkaHttpApiFollowingJsonApiSpec.scala
simple Akka Http API including links according to JSON API spec http://jsonapi.org/
import akka.actor.ActorSystem
import akka.event.LoggingAdapter
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import akka.http.scaladsl.marshalling.{ToEntityMarshaller, Marshaller}
import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Directives._
import akka.stream.Materializer
import com.oxyme.monitoring.HealthChecker
import com.oxyme.monitoring.model.{Unhealthy, Healthy}
import com.typesafe.config.{ConfigFactory, Config}
@getmetorajesh
getmetorajesh / Dockerfile
Last active March 26, 2017 13:40
Dockerfile for scala and sbt
FROM openjdk:8
ENV SCALA_VERSION 2.12.1
ENV SBT_VERSION 0.13.13
# Scala expects this file
RUN touch /usr/lib/jvm/java-8-openjdk-amd64/release
# Install Scala
## Piping curl directly in tar
RUN \
curl -fsL http://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | tar xfz - -C /root/ && \
alias d="docker"
alias dc="dc"
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.local.brain</groupId>
<artifactId>MavenTestApp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>MavenTestApp</name>