Skip to content

Instantly share code, notes, and snippets.

Avatar

François Kawala Fkawala

  • Expedia
  • Genève, Suisse
View GitHub Profile
@Fkawala
Fkawala / build_certs.sh
Last active Mar 29, 2020
Use the install.sh script to setup a nginx reverse proxy serving POSBOX on https using self issued SSL certificates. This will also setup the CA in the trusted CA for chrome and firefox browsers for $COOP_USER.
View build_certs.sh
apt -y --no-install-recommends install libssl1.0.0
openssl genrsa -aes256 -out ca.key.pem 2048
chmod 400 ca.key.pem
openssl genrsa -out localhost.key.pem 2048
openssl req -subj "/CN=${CERT_NAME}" -extensions v3_req -sha256 -new -key localhost.key.pem -out localhost.csr
openssl req -new -x509 -subj "/CN=${CERT_NAME}" -extensions v3_ca -days 3650 -key ca.key.pem -sha256 -out ${CERT_NAME}.pem -config localhost.cnf
openssl x509 -req -extensions v3_req -days 3650 -sha256 -in localhost.csr -CA ${CERT_NAME}.pem -CAkey ca.key.pem -CAcreateserial -out localhost.crt -extfile localhost.cnf
View x.scala
import org.apache.spark.SparkConf
import org.apache.spark.serializer.KryoSerializer
import org.apache.spark.sql.SparkSession
import org.apache.spark.ml.feature.VectorAssembler
import scala.util.Random
import ml.dmlc.xgboost4j.scala.spark.{XGBoostClassifier, XGBoostRegressor}
val n = 10000
val x0 = 2
val data = (1 to n).map(x => (Random.nextFloat()))
View container_helper.py
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
View container_helper.py
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
View Dockerfile.con
# Dockerfile extending the generic Python image with application files for a single application.
FROM ubuntu:latest
# First we install https transportation for APT. Indeed skewed.de forces https.
RUN apt-get update
RUN apt-get install -y \
python-pip
ADD requirements /tmp/requirements
RUN pip install --upgrade pip
@Fkawala
Fkawala / Dockerfile
Last active Oct 19, 2016
google cloud logging protobuff RequestLog
View Dockerfile
# Dockerfile extending the generic Python image with application files for a
# single application.
FROM ubuntu:latest
# And add a bunch of packages.
RUN apt-get update
RUN apt-get install -y \
python-pip \
python-crypto \
python-openssl
View benchmark.py
import graph_tool as gt
import graph_tool.topology as topology
import cProfile, pstats, StringIO
pr = cProfile.Profile()
g = gt.load_graph('graph.gt.gz')
source = 1569333
pr.enable()
topology.shortest_distance(g, source=source, weights=g.ep["length"], max_dist=2000, pred_map=True)
pr.disable()
@Fkawala
Fkawala / mwe.py
Last active Jul 12, 2016
MWE graph_tool shortest path / distance with multiple targets
View mwe.py
import graph_tool as gt
from graph_tool.topology import shortest_path, shortest_distance
g = gt.Graph()
v = list(g.add_vertex(10))
for i in range(9):
g.add_edge(i,i+1)
# MVE of shortest_path with several targets
vlists, elists = shortest_path(g,v[0], v[-3:])