Skip to content

Instantly share code, notes, and snippets.

View deskoh's full-sized avatar
👽
iamdeskoh

Desmond Koh deskoh

👽
iamdeskoh
View GitHub Profile
version: '3.7'
services:
zookeeper:
container_name: zookeeper
image: docker.io/bitnami/zookeeper:3.8
ports:
- "2181:2181"
volumes:
- "zookeeper_data:/bitnami"
@deskoh
deskoh / ChannelTests.md
Created April 8, 2021 06:33
FeathersJS Recipes
const feathers = require('@feathersjs/feathers');
const socketio = require('@feathersjs/socketio');
const { socket: commons } = require('@feathersjs/transport-commons');
const assert = require('assert');
const { EventEmitter } = require('events');

const messages = require('../src/messages');

describe('\'messages\' service', () => {
@deskoh
deskoh / ._WSL2-CentOS.md
Last active October 18, 2021 10:24
install centos WSL2

Install CentOS in WSL2

docker run --name centos -t centos:8 bash ls /
docker export centos -o centos8.tar
mkdir -p D:\wsl\CentOS8
wsl --import CentOS8 D:\wsl\CentOS8 centos8.tar
# Set default distro
wsl -s CentOS8
@deskoh
deskoh / windows-terminal-settings.jsonc
Created August 16, 2020 07:57
Windows Terminal Settings
// This file was initially generated by Windows Terminal 0.11.1121.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@deskoh
deskoh / LiveUpdate S3 Sync.bat
Last active November 28, 2024 07:35
Symantec EndPoint Protection Cheatsheet
forfiles -p "C:\Program Files (x86)\Symantec\LiveUpdate Administrator\clu-prod" -s -m *.* -d -1 -c "cmd /c del @path"
explorer "C:\Program Files (x86)\Symantec\LiveUpdate Administrator\clu-prod"
call aws s3 rm s3://my-bucket/clu-prod --recursive
call aws s3 cp "C:/Program Files (x86)/Symantec/LiveUpdate Administrator/clu-prod/" s3://my-bucket/clu-prod --recursive
@deskoh
deskoh / s3-download.js
Last active August 6, 2020 02:08
NodeJS S3 Upload / Download
const fs = require('fs')
const AWS = require('aws-sdk')
const BUCKET_NAME = 'my-bucket'
const ACCESS_KEY = 'AKIAXXXXXXXXXXXXXXXX'
const SECRET_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
const FILE = 'file-to-download.txt'
AWS.config.update({
region: 'ap-southeast-1',
@deskoh
deskoh / _AWS Resource-Based Policy Examples.md
Last active April 18, 2024 22:38
AWS Resource-based policies example

AWS Resource-Based Policy Examples

@deskoh
deskoh / rsa-encrypt-decrypt.js
Created May 20, 2020 02:55
NodeJS RSA Cryptoraphy
const crypto = require('crypto');
const keyPair = crypto.generateKeyPairSync('rsa', {
// Max length of plaintext = (512 / 8) - 42 = 22 bytes
modulusLength: 512,
publicKeyEncoding: {
type: 'spki',
format: 'pem'
},
privateKeyEncoding: {
@deskoh
deskoh / sftp-client.js
Last active May 17, 2020 04:54
SFTP Client
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const Client = require('ssh2-sftp-client');
// Host public key e.g. /etc/ssh/ssh_host_ecdsa_key.pub
const fingerprint = process.env.HOST_FINGERPRINT;
const hostConfig = {
host: process.env.HOST,
port: process.env.PORT || 22,
@deskoh
deskoh / README.md
Last active May 23, 2020 02:00
VS Code Debug Recipes

Debugging Receipes for VS Code