Skip to content

Instantly share code, notes, and snippets.

View deskoh's full-sized avatar
👽
iamdeskoh

Desmond Koh deskoh

👽
iamdeskoh
View GitHub Profile
@deskoh
deskoh / webcrypto-examples.md
Created May 9, 2020 14:00 — forked from pedrouid/webcrypto-examples.md
Web Cryptography API Examples
@deskoh
deskoh / jwt.js
Created May 3, 2020 23:19
Asymmetric JWTs
var assert = require('assert')
var crypto = require('crypto')
var jose = require('jose')
var jws = require('jws')
var convert = require('jwk-to-pem')
var { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
@deskoh
deskoh / Jenkinsfile
Last active April 30, 2024 03:04
Jenkinsfile Examples
Jenkinsfile examples
@deskoh
deskoh / artifactory.conf
Last active July 28, 2022 08:03
Artifactory Nginx Configuration
###########################################################
## this configuration was generated by JFrog Artifactory ##
###########################################################
## server configuration
server {
listen 80 ;
server_name ~(?<repo>.+)\.jfrog.dev.local jfrog.dev.local;
@deskoh
deskoh / nodejs.jenkinsfile
Created November 3, 2019 09:02
Jenkinsfile
pipeline {
agent none
stages {
stage('Checkout') {
agent {
docker { image 'node:alpine' }
}
stages {
@deskoh
deskoh / Solace.md
Last active October 7, 2021 08:44
Solace PubSub+

Solace PubSub+

Solace CLI

Command Reference

Running CLI in Docker container: docker exec -it pubSubStandardSingleNode /usr/sw/loads/currentload/bin/cli -A

Advanced: Running CLI Scripts

@deskoh
deskoh / self-signed-certificate-with-custom-ca.md
Last active February 24, 2021 09:19 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

TLDR

# Generate CA key and cert (use -nodes to remove pass phrase)
openssl req -x509 -nodes -newkey rsa:2048 -keyout rootCA.key \
  -days 1024 -out rootCA.crt \
  -subj "/C=SG/OU=www.org/O=MyOrg, Inc./CN=My Org Root CA"
# Generate server key and CSR (OpenSSL 1.1.1+)
@deskoh
deskoh / async-js.md
Last active January 8, 2021 04:34
JavaScript Async Function

async function ensures function always returns a promise

Non-promise return value will be wrapped in a promise

async function increment(num) {
  // Value will be wrapped in a promise
  return num + 1;
}
@deskoh
deskoh / default-spa.conf
Last active March 23, 2020 14:34
NGINX Config
server {
listen 80;
listen [::]:80 default ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name _; # all hostnames
location / {
@deskoh
deskoh / app.js
Last active July 29, 2019 06:18 — forked from marshallswain/app.js
Authenticate on feathers-socketio connection with header
const socketio = require('feathers-socketio')
const authOnSocketConnect = require('./authenticate-on-socket-connect')
// ... Setup your Feathers app code or use the generator then replace the socketio registration with this
// When you register the feathers-socketio plugin, use the utility
app.configure(socketio(function (io) {
// Get Socket.io headers
io.on('connection', function (socket) {
authOnSocketConnect({ app, socket })