Skip to content

Instantly share code, notes, and snippets.

@zouzias
zouzias / mysqlJDBCSparkExample.scala
Last active May 5, 2019 23:40
Spark JDBC DataFrame Example
val jdbc = spark.read.format("jdbc").option("url", "jdbc:mysql://localhost:3306/wikipedia").option("dbtable", "wikipedia.page").option("user", "root").option("password", "XXXX").load
@zouzias
zouzias / nginxproxy.md
Created November 7, 2016 23:29 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@muuki88
muuki88 / jenkins-sbt.groovy
Created November 2, 2016 17:03
Jenkins 2.0 SBT build pipeline
node {
stage('Git') {
git 'https://github.com/muuki88/activator-play-cluster-sample.git'
}
stage('Build') {
def builds = [:]
builds['scala'] = {
// assumes you have the sbt plugin installed and created an sbt installation named 'sbt-0.13.13'
sh "${tool name: 'sbt-0.13.13', type: 'org.jvnet.hudson.plugins.SbtPluginBuilder$SbtInstallation'}/bin/sbt compile test"
}
@zouzias
zouzias / convertCitiesToWKT.py
Created August 11, 2016 17:27
Convert GeoJSON data to WKT
import json
import geojson
from shapely.geometry import shape
# Get cities from https://github.com/mahemoff/geodata/blob/master/cities.geojson
with open('cities.geojson') as json_data:
d = json.load(json_data)
for country in d['features']:
name = country['properties']['city']
@zouzias
zouzias / csvToJSON.py
Last active September 12, 2016 20:21
Convert CSV to JSON with two nested categories
import csv
import json
csvfile = open('voronoid-graph.csv', 'r')
jsonfile = open('output.json', 'w')
fieldnames = ("gene","subcategory","category")
categories = {}
@phatak-dev
phatak-dev / README.md
Last active July 2, 2021 05:03
Functional Programming in C++

#Compilng You need g++ 4.9 to compile this code. Follow these steps to install g++-4.9

After installing run the following command to compile

/usr/bin/g++-4.9 -std=c++11 lambda.cpp

#Running

./a.out
@learncodeacademy
learncodeacademy / gist:5f84705f2229f14d758d
Last active July 16, 2024 04:56
Getting Started with Vagrant, SSH & Linux Server Administration

Deploying Yeoman apps to Heroku

Prerequisites

This assumes you already have a Yeoman app and are ready for publishing

Build for Production

Create production directory & assets

@ayosec
ayosec / 0README.md
Last active February 10, 2017 00:52
Spray: example with a router based on actors

Test with

$ sbt run

And then,

$ curl localhost:8080/mars/hi

$ curl localhost:8080/jupiter/hi

@hryk
hryk / setup.py
Created October 22, 2012 12:28
an example for using boost::unordered_map in Cython.
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("test_um",
["test_um.pyx"],
include_dirs=["/usr/local/include/boost"],
library_dirs=["/usr/local/lib"],
language="c++")