Skip to content

Instantly share code, notes, and snippets.

@xhoong
xhoong / encrypt_openssl.md
Created October 8, 2019 14:31 — forked from dreikanter/encrypt_openssl.md
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:

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
xhoong / windowing.scala
Created June 20, 2018 06:45 — forked from adamw/windowing.scala
Windowing data in Akka
package com.softwaremill.akka
import java.time._
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.Source
import scala.collection.mutable
import scala.concurrent.Await
@xhoong
xhoong / Read.md
Created April 13, 2018 15:34 — forked from ayushmishra2005/Read.md
Store Scala Collection Into PostgreSQL using Slick

Open PostgreSQL and Create a table student in database student.

CREATE EXTENSION hstore;

CREATE TABLE student (
    id     int,
    name   varchar(254) NOT NULL,
    hobbies  text[],
    marks hstore
);
@xhoong
xhoong / ambari-api
Created July 11, 2016 09:04 — forked from glinmac/ambari-api
ambari api examples
#!/bin/sh
AMBARI_USER=admin
AMBARI_PASSWORD=
CLUSTER_NAME=sandbox
AMBARI_API=http://127.0.0.1:8080/api/v1/clusters/$CLUSTER_NAME
BLUEPRINT_API=http://127.0.0.1:8080/api/v1/blueprints
hostname="hostname.example.com"
service="aservice"