Skip to content

Instantly share code, notes, and snippets.

View ravindranathakila's full-sized avatar

Ravindranath Akila ravindranathakila

View GitHub Profile
@ravindranathakila
ravindranathakila / clean_code.md
Created February 6, 2021 05:36 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

FROM openjdk:14-alpine
ARG D
ENV D=$D
ENV P=8080
ENV PROFILE=p
ADD build/distributions/$D.tar /opt/run/
EXPOSE $P
ENTRYPOINT /opt/run/$D/bin/$D
@ravindranathakila
ravindranathakila / balance.go
Created October 1, 2019 10:26 — forked from darkhelmet/balance.go
Simple TCP load balancer in Go.
package main
import (
"flag"
"io"
"log"
"net"
"strings"
)
@ravindranathakila
ravindranathakila / If same same
Created February 21, 2019 13:27
If same same
If same same, can add
#! /usr/bin/env bash
DAEMONS="${DAEMONS} \
zookeeper-server \
hadoop-hdfs-datanode \
hadoop-hdfs-journalnode \
hadoop-hdfs-namenode \
hadoop-hdfs-secondarynamenode \
hadoop-httpfs \
hadoop-mapreduce-historyserver \
@ravindranathakila
ravindranathakila / run_docker_cloudera_quickstart.sh
Last active February 6, 2017 06:31
# Runs Cloudera Quick Start image with commonly used Web UI ports. Perquisites: Cloudera Quickstart Image already pulled as cloudera
#!/usr/bin/env bash
_usage(){
grep "^[^_].\+(){$" $0 | while read line; do
local cmd=$(echo "$line" | sed "s/(){//g")
local info=$(grep -C0 -A0 -B1 "$cmd(){" $0 | sed "N;s/\n.*//g" )
printf " $0 %-20s %-40s\n" "$cmd" "$info" | grep "#"
done; echo "";
}
# Runs Cloudera Quick Start image with commonly used Web UI ports. Perquisites: Cloudera Quickstart Image already pulled as cloudera
@ravindranathakila
ravindranathakila / pedantically_commented_playbook.yml
Created October 17, 2016 05:40 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
package example;
import java.util.Properties;
import cascading.flow.Flow;
import cascading.flow.FlowDef;
import cascading.flow.hadoop.HadoopFlowConnector;
import cascading.pipe.CoGroup;
import cascading.pipe.Pipe;
import cascading.pipe.assembly.CountBy;

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

//mapper
package com.tistory.devyongsik.hadoop.mapre;
import java.io.IOException;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;