Skip to content

Instantly share code, notes, and snippets.

View jongha's full-sized avatar

Jong-Ha Ahn jongha

View GitHub Profile
@jongha
jongha / gist:be7b945ecc782c53ac7a850078ec95e5
Created March 9, 2018 07:46 — forked from ilguzin/gist:6606011
How to convert Java Key Store file to pem/key for nginx
1. Convert our ".jks" file to ".p12" (PKCS12 key store format):
keytool -importkeystore -srckeystore oldkeystore.jks -destkeystore newkeystore.p12 -deststoretype PKCS12
1.1. List new keystore file contents:
keytool -deststoretype PKCS12 -keystore newkeystore.p12 -list
2. Extract pem (certificate) from ".p12" keysotre file:
@jongha
jongha / BitFlags.kt
Created December 30, 2018 05:14 — forked from LouisCAD/BitFlags.kt
Allows simple bit flags operation on int values in kotlin. Inspired by: http://stackoverflow.com/a/40588216/4433326
@file:Suppress("NOTHING_TO_INLINE")
import kotlin.experimental.and // Used for Byte
import kotlin.experimental.inv // Used for Byte
import kotlin.experimental.or // Used for Byte
inline fun Int.hasFlag(flag: Int) = flag and this == flag
inline fun Int.withFlag(flag: Int) = this or flag
inline fun Int.minusFlag(flag: Int) = this and flag.inv()