Skip to content

Instantly share code, notes, and snippets.

View geoHeil's full-sized avatar

geoHeil geoHeil

View GitHub Profile
@geoHeil
geoHeil / foo.xml
Created April 1, 2018 08:40
xml demo of data
<?xml version="1.0" encoding="UTF-8"?>
<measCollecFile>
<measData>
<managedElement userLabel="abc"/>
<measInfo measInfoId="11111">
<granPeriod duration="1" endTime="2018-01-01:00:00:00"/>
<repPeriod duration="1"/>
<measTypes>1 2 3 4 5 6 </measTypes>
<measValue measObjLdn="abc/asdf.=3">
<measResults>1024 36.733 25.5 56 4.933 8 </measResults>
install
cdrom
lang en_US.UTF-8
keyboard de
network --bootproto=dhcp --ipv6=auto --activate
rootpw --plaintext vagrant
firewall --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Europe/Vienna
@geoHeil
geoHeil / atlas.sh
Last active December 13, 2017 15:45
playing with the latest atlas version
git clone https://github.com/geoHeil/atlas.git
cd atlas
git checkout dockerAtlasChangeUrl
# --------------------------------------------------
# docker playground
cd dev-support/atlas-docker/
docker build -t atlas_docker .
docker run -it -p 21000:21000 atlas_docker
# open your browser and go to
http://localhost:21000
# connect to utility node
hostname -f
# output: c
sudo vi /etc/ambari-agent/conf/ambari-agent.ini
# configure hostname=ip-172-31-25-199.eu-west-1.compute.internal
# reload / restart
systemctl restart ambari-agent
systemctl status ambari-agent
systemctl start ambari-agent
@geoHeil
geoHeil / Vagrantfile
Last active January 5, 2018 08:46
Cloudbreak vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# Base Box
config.vm.box = "centos/7"
# Base IP address range used for VMs. Pretty sure not to be already used on the local network.
$BASE_RANGE = ENV.fetch("BASE_RANGE", "10.200.0.")
cloudbreak_ip = $BASE_RANGE + ENV.fetch("CB_IP", "3")
@geoHeil
geoHeil / foo.scala
Last active December 10, 2017 07:58
configuration ficus
import com.typesafe.config.{ Config, ConfigFactory }
import net.ceedubs.ficus.Ficus._
import net.ceedubs.ficus.readers.ValueReader
import net.ceedubs.ficus.readers.namemappers.implicits.hyphenCase
object ConfigurationUtils {
def loadConfiguration[T: ValueReader](): T = {
val config: Config = ConfigFactory.load()
config.as[T]
val f1: DataFrame = g.find("(a)-[e1]->(b)")
.withColumn("level", lit("f1"))
.withColumnRenamed("a", "src")
.withColumnRenamed("b", "dst")
.select("src", "dst", "level")
val f2: DataFrame = g.find("(a)-[e1]->(b);(b)-[e2]->(c)").withColumn("level", lit("f2"))
.withColumnRenamed("a", "src")
.withColumnRenamed("c", "dst")
.drop("b")
.select(f1.columns.map(col _): _*)
val friends: DataFrame = g.find("(a)-[e]->(b)")
friends.show
friends.groupBy('a).agg(mean($"b.fraud").as("fraud"))
.withColumn("id", $"a.id")
.withColumn("name", $"a.name")
.withColumn("fraud_src", $"a.fraud")
.drop("a")
.show
MATCH p = (source:Person)-[:call|text]-(destination:Person)
RETURN
source.name as Vertex,
source.known_terrorist as known_terrorist,
apoc.coll.avg(COLLECT(
CASE WHEN ALL(r in relationships(p) where type(r)='call') THEN destination.known_terrorist ELSE NULL END
)) as type_undir_1_call,
apoc.coll.avg(COLLECT(
CASE WHEN ALL(r in relationships(p) where type(r)='text') THEN destination.known_terrorist ELSE NULL END
)) as type_undir_1_text,
╒═════════════╤════════════════════════╤══════════════════════════════════╕
│"source.name"│"source.known_terrorist"│"avg(destination.known_terrorist)"│
╞═════════════╪════════════════════════╪══════════════════════════════════╡
│"Gabby" │0 │0.13333333333333336 │
├─────────────┼────────────────────────┼──────────────────────────────────┤
│"Esther" │0 │0.30434782608695654 │
├─────────────┼────────────────────────┼──────────────────────────────────┤
│"Charlie" │0 │0.3333333333333333 │
├─────────────┼────────────────────────┼──────────────────────────────────┤
│"David" │0 │0.3589743589743589 │