Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Browning bbrowning

  • Red Hat
  • Brevard, NC
View GitHub Profile
@bbrowning
bbrowning / 0_README.md
Last active Apr 28, 2020
Deploying OpenShift Serverless 1.7.0 stage builds on external OpenShift 4.3 clusters
View 0_README.md

Note: This is only tested on OCP 4.3 or 4.4 clusters

Disable the default OLM operator sources:

oc patch OperatorHub cluster --type json \
  -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'

Download the imageContentSourcePolicy.yaml from this gist and apply it.

@bbrowning
bbrowning / activationStats.sh
Created Apr 12, 2018
Useful script to display recent activation stats from OpenWhisk
View activationStats.sh
#!/usr/bin/env bash
# set -x
set -e
func=$1
count=$2
if [ "${func}x" = "x" ]; then
echo "You must supply a function as the first argument"
@bbrowning
bbrowning / openshift_instructions.md
Last active Aug 22, 2018
Running Apache OpenWhisk on OpenShift
View openshift_instructions.md

Running Apache OpenWhisk on OpenShift

Prerequisites

These instructions assume you are using Minishift 1.0.1 or newer as your OpenShift installation.

You'll also need a wsk binary in your $PATH to interact with OpenWhisk after it's deployed. Download the latest version for your OS

View Gemfile
source 'https://rubygems.org'
gem 'multi_json'
@bbrowning
bbrowning / Main.java
Last active May 12, 2017
An example of using Undertow ResponseHeader filters with WildFly Swarm
View Main.java
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.wildfly.swarm.config.undertow.FilterConfiguration;
import org.wildfly.swarm.config.undertow.configuration.ResponseHeader;
import org.wildfly.swarm.config.undertow.server.host.FilterRef;
import org.wildfly.swarm.container.Container;
import org.wildfly.swarm.undertow.UndertowFraction;
import org.wildfly.swarm.undertow.WARArchive;
public class Main {
public static void main(String... args) throws Exception {
@bbrowning
bbrowning / jvm-npm.diff
Last active Sep 16, 2015
undertow.js w/ jvm-npm.js
View jvm-npm.diff
--- jvm-npm.js.orig 2015-09-16 09:19:07.007874748 -0400
+++ jvm-npm.js 2015-09-15 16:25:25.607810957 -0400
@@ -237,7 +237,7 @@
function resolveCoreModule(id, root) {
var name = normalizeName(id);
var classloader = java.lang.Thread.currentThread().getContextClassLoader();
- if (classloader.findResource(name))
+ if (classloader.findResource(name, false))
return { path: name, core: true };
}
View jruby_selector_leak.rb
num_runtimes = 10
puts "Creating runtimes..."
num_runtimes.times do
instance = org.jruby.Ruby.newInstance
instance.evalScriptlet <<-EOS
require "socket"
server = TCPServer.new(0)
Thread.new do
begin
@bbrowning
bbrowning / indexed_queue.diff
Created May 18, 2015
These are benchmark results of an implementation of async.queue based on maintaining an index into the queue as items are processed instead of shifting items off the queue. The new implementation is shown as "indexed async.queue" in the benchmark results, with the old one shown as "upstream async.queue". For larger queues, the performance differ…
View indexed_queue.diff
diff --git a/lib/async.js b/lib/async.js
index 394c41c..8d91ab5 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -832,6 +832,120 @@
return q;
};
+ async.indexedQueue = function (worker, concurrency) {
+ if (concurrency === undefined) {
@bbrowning
bbrowning / double_load.rb
Created Jan 23, 2015
JRuby 9k double loading file if explicit require and autoload are used
View double_load.rb
autoload :ProxyObject, 'proxy_object.rb'
require 'proxy_object'
@bbrowning
bbrowning / output.txt
Last active Aug 29, 2015
RubyGems 2.4.5 triggers JRuby logic error when loading Java extensions from absolute paths
View output.txt
$ bin/jruby -S gem install atomic
Fetching: atomic-1.1.16-java.gem (100%)
Successfully installed atomic-1.1.16-java
1 gem installed
$ bin/jruby ~/tmp/rubygems_java_ext_broken.rb
absolute paths are broken
relative paths work