sudo mkdir /etc/mesos-dns
sudo vi /etc/mesos-dns/config.json
server { # simple load balancing | |
listen 80; | |
location / { | |
proxy_pass http://localhost:3000; | |
} | |
} |
[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 |
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> { | |
<?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, |
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) |
Beautiful is better than ugly. Explicit is better than implicit.
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])) |