Skip to content

Instantly share code, notes, and snippets.

Xavier L. xhoong

Block or report user

Report or block xhoong

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
xhoong /
Created Oct 8, 2019 — forked from dreikanter/
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

xhoong / slickPlainSQL.scala
Created Mar 14, 2019
Mapping plain SQL in Slick to a case class
View slickPlainSQL.scala
case class MetroSystemWithCity(metroSystemName: String, cityName: String,
dailyRidership: Int)
implicit val getMetroSystemWithCityResult = GetResult(r =>
MetroSystemWithCity(r.nextString, r.nextString, r.nextInt))
val query = sql"""SELECT,, ms.daily_ridership
FROM metro_system as ms
JOIN city AS c ON ms.city_id =
View Generate ssl certificates with Subject Alt Names on

Generate ssl certificates with Subject Alt Names on OSX

We can generate a common CA certificate, and then each project can use this CA certificate to sign and issue a project certificate. Hence the CA certificate is needed to install as a trusted cert, and once the project is signed and issue using this CA cert, the new project certificate will be trusted via chain of trust policy.

Generate a CA key

openssl genrsa -out ca.key 4096

Generate a CA public key, ensure expiry date is exceeding the individual cert

xhoong / windowing.scala
Created Jun 20, 2018 — forked from adamw/windowing.scala
Windowing data in Akka
View windowing.scala
package com.softwaremill.akka
import java.time._
import scala.collection.mutable
import scala.concurrent.Await
xhoong /
Created Apr 13, 2018 — forked from ayushmishra2005/
Store Scala Collection Into PostgreSQL using Slick

Open PostgreSQL and Create a table student in database student.


CREATE TABLE student (
    id     int,
    name   varchar(254) NOT NULL,
    hobbies  text[],
    marks hstore
View truncate-log
truncate -s 0 /var/lib/docker/containers/*/*-json.log
View gist:b2912a27cbff5b9cde603a2612917ee6
* Used for reading/writing to database, files, etc.
* Code From the book "Beginning Scala"
def using[A <: {def close(): Unit}, B](param: A)(f: A => B): B =
try { f(param) } finally { param.close() }
def writeToFile(fileName:String, data:String) =
xhoong / ambari-api
Created Jul 11, 2016 — forked from glinmac/ambari-api
ambari api examples
View ambari-api
You can’t perform that action at this time.