Skip to content

Instantly share code, notes, and snippets.

{
"title": "Services",
"style": "dark",
"editable": true,
"failover": false,
"panel_hints": true,
"refresh": true,
"index": {
"default": "NO_TIME_FILTER_OR_INDEX_PATTERN_NOT_MATCHED",
"pattern": "[logstash-]YYYY.MM.DD",
{
"title": "Services",
"style": "dark",
"editable": true,
"failover": false,
"panel_hints": true,
"refresh": true,
"index": {
"default": "NO_TIME_FILTER_OR_INDEX_PATTERN_NOT_MATCHED",
"pattern": "[logstash-]YYYY.MM.DD",
@mje113
mje113 / gist:9829932
Created March 28, 2014 10:43
manticore redirect test
require 'manticore'
require 'webrick'
class Redirector < WEBrick::HTTPServlet::AbstractServlet
PORT = 9123
def do_GET(request, response)
case request.path
when '/'
response.status = 200
[1] pry(main)> require 'torquebox-cache'
=> false
[2] pry(main)> cache = TorqueBox::Infinispan::Cache.new( :name => 'treasure' )
=> #<TorqueBox::Infinispan::Cache:0x622b87e8
@cache=#<Object:0x17e7c2b2>,
@codec=TorqueBox::Codecs::MarshalSmart,
@options={:name=>"treasure"}>
[3] pry(main)> cache.put('abcd', 'asdfafdasdf')
=> nil
[4] pry(main)> cache.get('abcd')
11:17:23,416 INFO [org.quartz.core.QuartzScheduler] (MSC service thread 1-11) JobFactory set to: org.torquebox.jobs.JobScheduler@6165e04b
11:17:23,416 INFO [org.quartz.core.QuartzScheduler] (MSC service thread 1-9) JobFactory set to: org.torquebox.jobs.JobScheduler@13ae3d1
11:17:23,417 INFO [org.quartz.core.QuartzScheduler] (MSC service thread 1-11) Scheduler jboss.deployment.unit."gateway-knob.yml".job_scheduler_$_NON_CLUSTERED started.
11:17:23,417 INFO [org.quartz.core.QuartzScheduler] (MSC service thread 1-9) Scheduler jboss.deployment.unit."partner_integration_layer-knob.yml".job_scheduler_$_NON_CLUSTERED started.
11:17:23,908 INFO [org.torquebox.core.runtime] (pool-1-thread-1) Setting up Bundler
11:17:23,915 INFO [org.torquebox.core.runtime] (pool-1-thread-5) Setting up Bundler
11:17:25,198 INFO [stdout] (pool-1-thread-5) Could not find activesupport-4.0.2 in any of the sources
11:17:25,199 INFO [stdout] (pool-1-thread-5) Run `bundle install` to install missing gems.
11:17:25,199 ERROR [org.torq
@mje113
mje113 / gist:9190455
Last active August 29, 2015 13:56
Ruby 2.1 method injection POC
module Instrumenter
def instrument(method)
alias_method "_#{method}", method
define_method method do
start = Time.now
result = send("_#{method}")
puts "Elapsed: #{Time.now - start}"
result
end
$ ping github.com
PING github.com (192.30.252.131): 56 data bytes
64 bytes from 192.30.252.131: icmp_seq=0 ttl=248 time=88.360 ms
Request timeout for icmp_seq 1
64 bytes from 192.30.252.131: icmp_seq=2 ttl=248 time=91.491 ms
64 bytes from 192.30.252.131: icmp_seq=3 ttl=248 time=91.730 ms
64 bytes from 192.30.252.131: icmp_seq=4 ttl=248 time=86.243 ms
64 bytes from 192.30.252.131: icmp_seq=5 ttl=248 time=89.297 ms
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
# A
100.times do |i|
case [i % 3 == 0, i % 5 == 0]
when [true, true] then puts 'Fizz Buzz'
when [true, false] then puts 'Fizz'
when [false, true] then puts 'Buzz'
else
puts i
end
end
$ sudo dpkg -i couchbase-server-enterprise_2.2.0_x86_64.deb
Selecting previously unselected package couchbase-server.
(Reading database ... 70796 files and directories currently installed.)
Unpacking couchbase-server (from couchbase-server-enterprise_2.2.0_x86_64.deb) ...
libssl1* is installed. Continue installing
Minimum RAM required : 4 GB
System RAM configured : 3145728 kB
Minimum number of processors required : 4 cores
Number of processors on the system : 32 cores
Setting up couchbase-server (2.2.0) ...
@mje113
mje113 / gist:6823395
Created October 4, 2013 09:33
Example usage of Couchbase Java SDK 1.2.0 callbacks on an async set (in JRuby).
module Couchbase
class AsyncCallback
include Java::NetSpyMemcachedInternal::OperationCompletionListener
def initialize(callback)
@callback = callback
end
def onComplete(future)