Skip to content

Instantly share code, notes, and snippets.

View vertx-prometheus.java
CollectorRegistry collectorRegistry = new CollectorRegistry();
PrometheusMeterRegistry micrometerRegistry =
new PrometheusMeterRegistry(PrometheusConfig.DEFAULT, collectorRegistry, Clock.SYSTEM);
micrometerRegistry
.config()
.commonTags()
.commonTags(
"application",
metadata.getName(),
"env",
@rondinif
rondinif / check-java12-env
Created Apr 14, 2019
command line setup of [ openjdk version "12" ] on [ Mac OS X 10.14.3 ]
View check-java12-env
$ java -XshowSettings -version
Picked up JAVA_TOOL_OPTIONS: -Duser.country=US -Duser.language=en
VM settings:
Max. Heap Size (Estimated): 4.00G
Using VM: OpenJDK 64-Bit Server VM
Property settings:
awt.toolkit = sun.lwawt.macosx.LWCToolkit
file.encoding = UTF-8
file.separator = /
@ricardozanini
ricardozanini / how-to-install-graalvm-linux.md
Last active Aug 16, 2021
How to install GraalVM on Linux with alternatives
View how-to-install-graalvm-linux.md

How to Install GraalVM Community Edition on Linux

Note: Tested on Fedora only

  1. Download the new release of GraalVM and unpack it anywhere in your filesystem:
$ tar -xvzf graalvm-ce-1.0.0-rc14-linux-amd64.tar.gz
View Ruby Logger: how to set the log level from environment variable
# see: https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html
LOGLEVELS = %w[DEBUG INFO WARN ERROR FATAL UNKNOWN].freeze
LOGGER = Logger.new(STDOUT)
level ||= LOGLEVELS.index ENV.fetch("LOG_LEVEL","WARN") # default to WARN index: 2
level ||= Logger::WARN # FIX default in case of environment LOG_LEVEL value is present but not correct
LOGGER.level = level
# Usage:
# before launching the program:
# $ export LOG_LEVEL=DEBUG
View openshift kubernets api server discovery
# .1: GET API SERVERS
$ oc config view | grep server
server: https://127.0.0.1:8443
server: https://192.168.65.2:8443
server: https://192.168.99.100:8443
server: https://api.starter-us-east-1.openshift.com:443
$ oc config view | grep server | cut -f 2- -d ":"
https://127.0.0.1:8443
https://192.168.65.2:8443
@twmbx
twmbx / vanilla-ajax-poll.js
Last active Aug 17, 2021
Polling in JS with an async ajax call that returns a promise ( modified from: https://davidwalsh.name/javascript-polling )
View vanilla-ajax-poll.js
// The polling function
function poll(fn, timeout, interval) {
var endTime = Number(new Date()) + (timeout || 2000);
interval = interval || 100;
var checkCondition = function(resolve, reject) {
var ajax = fn();
// dive into the ajax promise
ajax.then( function(response){
// If the condition is met, we're done!
@ricardozanini
ricardozanini / change-soapui-workspacedir.md
Last active Aug 27, 2019
How to set the default workspace dir for SoapUI
View change-soapui-workspacedir.md

How to set the default workspace dir for SoapUI

  1. Locate the SoapUI installation dir
  2. Edit the SoapUI-X.X.X.vmoptions (X.X.X is the SoapUI version) and add the -Duser.home=<YOUR_NEW_WORKSPACE_DIR>.
  3. Restart SoapUI
  4. Done
@nmarley
nmarley / curl-websocket.sh
Created Sep 8, 2017 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
View curl-websocket.sh
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@1kastner
1kastner / reflect.py
Last active Jun 3, 2021 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
View reflect.py
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from http.server import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):