Skip to content

Instantly share code, notes, and snippets.

View cardin's full-sized avatar
🎸
🎶

Cardin Lee cardin

🎸
🎶
  • R&D and Engineering
  • Singapore
  • 20:07 (UTC +08:00)
View GitHub Profile
@cardin
cardin / nodejs-unhandled-uncaught-example.mjs
Last active May 5, 2022 03:30
Demonstrates NodeJS UncaughtException and UnhandledRejection
#! /usr/bin/env node
/*
npm install p-queue
*/
import PQueue from "p-queue";
process.on("uncaughtException", (err) => {
console.log("Uncaught!", err);
@cardin
cardin / exportPlantuml.sh
Last active February 5, 2022 15:20
Export PlantUML diagrams using Docker PlantUML Server
#!/usr/bin/env bash
########################
# Exports PlantUML diagrams using a Docker PlantUML Server.
# ARGS:
# $1 : Target directory to recursively search
# CONFIG:
# $port : Port to bind the PlantUML Server to
# $dockerName : Name of the Docker container
# $fileExt : File extensions that belong to PlantUML
# $dryRun : Detect files but not process them
@cardin
cardin / GitLab-Runner-Offline-Unregister.ps1
Created February 11, 2021 02:10
Offline GitLab Runners are not automatically unregistered, nor is there an easy GUI way to remove them. This script uses GitLab API to remove the runners.
#######################################
# Please replace this values
$gitlabUrl = "https://gitlab.com"
$bearerToken = "abcdefg"
#######################################
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer $bearerToken")
$runners = Invoke-RestMethod "$gitlabUrl/api/v4/runners?status=offline" `
-Headers $headers