Skip to content

Instantly share code, notes, and snippets.

@khsthomas
khsthomas / create_x509_certs.md
Created April 28, 2025 02:43 — forked from dasniko/create_x509_certs.md
Creating self signed tls certificates with self-signed root CA
@khsthomas
khsthomas / App.java
Created April 21, 2025 08:05 — forked from artem-smotrakov/App.java
Getting a caller's class name in Java with Thread.currentThread().getStackTrace()
public class App {
public static void main(String[] args) throws Throwable {
Logger.INSTANCE.log("started");
Logger.INSTANCE.log("hello");
foo();
Logger.INSTANCE.log("finished");
}
private static void foo() {
@khsthomas
khsthomas / curl.md
Created March 18, 2025 02:45 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@khsthomas
khsthomas / clickhousedump
Last active July 12, 2024 09:11 — forked from inkrement/clickhousedump
dump all clickhouse databases and tables
#!/bin/bash
#should set command alias
#alias cclient="clickhouse-client -u {default or user} --password '{well-escaped-password}' "
OUTDIR=.
while read -r db ; do
while read -r table ; do
@khsthomas
khsthomas / forticlientsslvpn-expect.sh
Created April 15, 2022 06:25 — forked from azizasm/forticlientsslvpn-expect.sh
Continuous run Forticlient VPN using expect. Automatically restart VPN if get disconnected or session closed.
#!/bin/bash
# Forticlient SSL VPN Client / expect
# --------------------------------------------
# CONFIGURATION
FORTICLIENT_PATH=""
@khsthomas
khsthomas / docker-cleanup-resources.md
Created January 6, 2022 08:55 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@khsthomas
khsthomas / install-openjdk.txt
Created December 3, 2021 01:59 — forked from douglarek/install-openjdk.txt
How to install openJDK 11 on macOS
$ curl -C - https://download.java.net/java/ga/jdk11/openjdk-11_osx-x64_bin.tar.gz -O openjdk-11_osx-x64_bin.tar.gz
$ tar xf openjdk-11_osx-x64_bin.tar.gz
$ sudo mv jdk-11.jdk /Library/Java/JavaVirtualMachines/
$ java -version
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
@khsthomas
khsthomas / nodejs-sample.js
Created January 12, 2021 08:42 — forked from jasonk000/nodejs-sample.js
Using x.509 certs with JWS/JWT/JWK
#!/usr/bin/env node
import fs from 'fs'
import jose from 'node-jose'
import pem from 'pem'
async function run () {
try {
// keystore to stick our node-jose keys before we do signing
let keystore = jose.JWK.createKeyStore()
@khsthomas
khsthomas / solving-cors-pentaho-cde.md
Created December 30, 2020 08:10 — forked from brenopolanski/solving-cors-pentaho-cde.md
Solving CORS problem on embedding Pentaho CDE dashboard in web application

Solving CORS problem on embedding Pentaho CDE dashboard in web application

Cross-Origin Resource Sharing (CORS) is a W3C spec that allows cross-domain communication from the browser. By building on top of the XMLHttpRequest object, CORS allows developers to work with the same idioms as same-domain requests.

Enable Cross Origin Resource Sharing (CORS) in the Community Dashboard Framework (CDF), Community Dashboard Editor (CDE), and Community Data Access (CDA). While you need CDE to embed the dashboard, you will access it from a different server other than the Pentaho Server, so CORS must be enabled in CDF, CDE and CDA. Open the following CDF, CDE, and CDA settings.xml files in a text editor:

  • For CDF: server/pentaho-server/pentaho-solutions/system/pentaho-cdf/settings.xml.
  • For CDE: server/pentaho-server/pentaho-solutions/system/pentaho-cdf-dd/settings.xml.
  • For CDA: server/pentaho-server/pentaho-solutions/system/cda/settings.xml.
@khsthomas
khsthomas / README.md
Created August 6, 2020 07:03 — forked from pcan/README.md
Redis test cluster without ruby

These scripts let you run Redis in cluster mode (only for testing/dev purpose), without using the redis-trib script (written in Ruby! who wants it!?). The create-cluster has been modified to assign cluster slots after creation.