Skip to content

Instantly share code, notes, and snippets.

SSH Tunneling A Multiple Node Span With MacOsX

I needed to get some work done on a jenkins server that unfortunately was behind a firewall, and was inaccessible even with my VPN turned on.

Fortunately I had SSH access to a machine inside the firewall that also had SSH access to the jenkins server. So I knew that there was a way to use SSH tunnelling to get to the jenkins server.

Tunnel between the localhost and the first node.

How to trigger a Jenkins job when merging to master on GitHub

Sometimes you want be able to trigger a jenkins job whevever you merge to master.
Fortunately there is a very useful Jenkins Plugin called Generic Webhook Trigger Plugin to help. This plugin is not specific to GitHub. It should work with any service that can post to a webhook.

The plugin let's you parse the JSON payload using either JSONPath or XPath; it even let's you set up key values based on the POST Headers or URL arguments.

Blacklight Search (deep dive):

I want to derive a mental picture of a blacklight search. I know that I submit a form and that a query is made against a solr db, the result of which is processed and returnd to me. However, I need a more detailed picture of the interim steps.

Specically I want to get at:

  1. What is the function that first receives the forms input?

Installing the jenkins.war file on CentOS 7 and configuring behind an Apache proxy.

Install jenkins

  • Create a jenkins user: sudo useradd jenkins
  • Install Java: sudo yum install java
  • Switch to the jenkins user: sudo su - jenkins
  • Download the jenkins.war file: wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
  • Install and run jenkins: nohup java -jar jenkins.war --prefix=/jenkins > copywar.out 2>&1 &
[frontends]
[frontends.jenkins]
backend = "jenkins"
[frontends.jenkins.routes.jenkins]
rule = "Host: jenkins.localhost"
[backends]
[backends.jenkins]
[backends.jenkins.servers.jenkins]
url = "http://localhost:8080"
module MyModule1
def foo
" baz " + super
end
end
module MyModule2
def foo
" biz " + super
def block_to_lambda(block = lambda {})
if block_given?
block = lambda { yield }
end
puts block.inspect
end
block_to_lambda {}
# Returns: #<Proc:0x00007fceeba0ed50@test_block.rb:49 (lambda)>
def block_method(&block)
block.inspect
end
block_method {}
# Returns: "#<Proc:0x00007f868a1f5348@(pry):8>"
def block_or_proc(block = Proc.new {|*args|})
if block_given?
block = Proc.new { |*args| yield args }
end
block
end
# Using blocks with no additional args.
a = block_or_proc { puts "hello" }
def block_or_proc(&block)
block
end
a = block_or_proc { puts "hello block" }
a.call
# Outputs: "hello block"
p = Proc.new { puts "hello proc" }
b = block_method(&p).call