Skip to content

Instantly share code, notes, and snippets.

View rohithreddy's full-sized avatar
🐢
working from dreams

Rohith rohithreddy

🐢
working from dreams
View GitHub Profile
@rohithreddy
rohithreddy / nginx_sites_enabled_local_proxy
Created March 17, 2019 21:06
conf file for running Nginx as reverse proxy
server { # simple load balancing
listen 80;
location / {
proxy_pass http://localhost:3000;
}
}
@rohithreddy
rohithreddy / metabase.conf
Created March 17, 2019 21:05
Supervisord running an example / metabase app
[program:metabasetest]
autostart = true
autorestart = true
command = /usr/bin/java -jar /home/rohith/metabase.jar
startretries = 3
user = rohith
directory = /home/rohith/
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Exception.Base
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Trans.Class
import Control.Monad.Trans.Reader
import qualified Data.ByteString.Char8 as BS
@rohithreddy
rohithreddy / AvroDeserializationSchema.java
Created March 11, 2018 11:45
Avro deserializer for Flink's Data Stream API Kafka Source
import org.apache.avro.io.BinaryDecoder;
import org.apache.avro.io.DatumReader;
import org.apache.avro.io.DecoderFactory;
import org.apache.avro.reflect.ReflectDatumReader;
import org.apache.avro.specific.SpecificDatumReader;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.typeutils.TypeExtractor;
public class AvroDeserializationSchema<T> implements DeserializationSchema<T> {
@rohithreddy
rohithreddy / 51-local.conf
Created November 16, 2017 07:51
Optimal Font Settings for Ubuntu or a modren linux based system
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match>
<edit mode="prepend" name="family"><string>Noto Sans</string></edit>
</match>
<match target="pattern">
<test qual="any" name="family"><string>serif</string></test>
<edit name="family" mode="assign" binding="same"><string>Noto Serif</string></edit>
</match>
DROP TABLE if exists d_date;
CREATE TABLE d_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
day_suffix VARCHAR(4) NOT NULL,
day_name VARCHAR(9) NOT NULL,
day_of_week INT NOT NULL,
@rohithreddy
rohithreddy / hello_mesos.py
Created July 1, 2016 23:45 — forked from porterjamesj/hello_mesos.py
the tiniest mesos scheduler
import logging
import uuid
import time
from mesos.interface import Scheduler
from mesos.native import MesosSchedulerDriver
from mesos.interface import mesos_pb2
logging.basicConfig(level=logging.INFO)
@rohithreddy
rohithreddy / hdfs-mesos.md
Created July 1, 2016 10:55 — forked from samklr/hdfs-mesos.md
Setup HDFS on Mesos, Run Spark Cluster dispatcher via Marathon

Setup Mesos-DNS

Scripts for setting up

sudo mkdir /etc/mesos-dns
sudo vi /etc/mesos-dns/config.json
@rohithreddy
rohithreddy / comprehensions.md
Created March 28, 2016 12:05 — forked from bearfrieze/comprehensions.md
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

All of the tasks presented in the examples can be accomplished with the extensive standard library available in Python. These solutions would arguably be more terse and efficient in some cases. I don't have anything against the standard library. To me there is a certain

import sys
'''sum of digits in a number'''
print(sum(int(i) for i in sys.argv[1]))