Skip to content

Instantly share code, notes, and snippets.

View Stwissel's full-sized avatar

Stephan H. Wissel Stwissel

View GitHub Profile
@Stwissel
Stwissel / Starter.java
Created August 3, 2022 04:06
Sidestart vert.x in its own thread and call an async operation in a sync block
package com.notessensei.legacy.sync_async;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.Vertx;
import io.vertx.core.eventbus.Message;
@Stwissel
Stwissel / sgspeedtest.sh
Created July 22, 2017 10:23
Command line speed Test for Singapore
#!/bin/bash
# Linux or Mac shell script to test download speeds in Singapore
# using the speedtest CLI https://github.com/sivel/speedtest-cli
# VERY quick and dirty
resultfile=speedresult.asc
speedparam='--secure --simple --server '
date >> $resultfile
echo 2054 Viewqwest Pte Ltd Singapore, Republic of Singapore [12.77 km]
echo 2054 Viewqwest Pte Ltd Singapore, Republic of Singapore [12.77 km] >> $resultfile
speedtest $speedparam 2054 >> $resultfile
@Stwissel
Stwissel / SimpleXMLDoc.java
Created April 13, 2020 14:39
Utility class to generate valid XML in Java, streaming style, see https://wissel.net/blog/2020/04/simplexmldoc-revisited.html for details
/**
* ========================================================================= *
* Copyright (C) 2006, 2007 TAO Consulting Pte <http://www.taoconsulting.sg/> *
* Copyright (C) 2011 IBM Corporation ( http://www.ibm.com/ ) *
* Copyright (C) 2020 HCL ( http://www.hcl.com/ ) *
* All rights reserved. *
* ========================================================================== *
* *
* Licensed under the Apache License, Version 2.0 (the "License"). You may *
* not use this file except in compliance with the License. You may obtain a *
@Stwissel
Stwissel / README.md
Last active April 26, 2019 04:36
Custom Action for Salesforce Marketing Cloud

Marketing Cloud Custom Action

The flow provides a boilerplate to create a custom action for consumption in Salesforce Marketing Cloud. The flow outputs the data received from marketing cloud in a debug node. So you need to add whatever you want to do at the level of that debug node

Setup

  • You need to open the the Test JWT node and edit the secret. Better: remove it and set the environment variable as described in the node's documentation
  • the endpoint path is /endpoints/demo. If you want to change that you need to edit 2 nodes: config.json and Action Node

Feedback

@Stwissel
Stwissel / SalesforceObjectKeys.json
Created March 20, 2019 02:53
Objects Keys Salesforce Spring 19
{
"100": "UserLicense",
"110": "ObjectPermissions",
"500": "Case",
"501": "Solution",
"570": "LiveChatTranscript",
"571": "LiveChatVisitor",
"572": "LiveChatDeployment",
"573": "LiveChatButton",
"574": "QuickText",
@Stwissel
Stwissel / stackoverflow.js
Created September 15, 2018 09:28
Simple nodeJS function to crash with a stackoverflow
/* This program will use a recursion to provoke a stackoverflow
use it at your own risk. It might take more than the runtime down.
*/
const looper = function(instanceCount) {
console.log(
`Calling instance ${instanceCount} with ${process.memoryUsage().heapUsed}`
);
var body = '';
for (var i = 0; i < 1000000; i++) {
@Stwissel
Stwissel / Excel2package.xslt
Last active February 23, 2019 07:51
Sample XSLT to generate a package.xml file for Salesforce ANT tool to remove dead fields
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns="http://soap.sforce.com/2006/04/metadata" exclude-result-prefixes="xs xd" version="2.0">
<xsl:output encoding="UTF-8" indent="yes" method="xml"/>
<xsl:param name="fieldNameColumn" select="'0'"/>
<xsl:param name="statusColumn" select="'5'"/>
<xsl:param name="isDeletable" select="'yes'"/>
@Stwissel
Stwissel / Validations-interactive.xslt
Last active February 8, 2019 02:37
XSLT Stylesheet to report on Validation formulas in Salesforce
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
exclude-result-prefixes="xs xd"
version="2.0">
<xsl:output method="html" omit-xml-declaration="yes" use-character-maps="no-control-characters"/>
<xsl:template match="/">
@Stwissel
Stwissel / ValidationReportGenerator.java
Last active February 7, 2019 16:16
Extract validation relevant files from object meta data files
/** ========================================================================= *
* Copyright (C) 2019 Salesforce Inc ( http://www.salesforce.com/ . *
* All rights reserved. *
* *
* @author Stephan H. Wissel (stw) <swissel@salesforce.com> *
* @notessensei *
* @version 1.0 *
* ========================================================================== *
* *
* Licensed under the Apache License, Version 2.0 (the "License"). You may *
@Stwissel
Stwissel / Json2XmlMain.java
Last active March 1, 2018 06:38
Json to XML and Back with vert.x
package net.wissel.json2xml;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.PrintWriter;