Skip to content

Instantly share code, notes, and snippets.

Jenkins Port Forwarding (8080 -> 80) with pf on Mavericks/Yosemite

This guide is a fork from this gist. I've added minor adjustments to customise these rules to forward connections from an outsite interface like en0.

Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

1. Create the anchor file

Create an anchor file under /etc/pf.anchors/com.jenkins with your redirection rule like:

@nm3mon
nm3mon / maven_create_project
Created February 13, 2014 15:20
Maven command to create a basic project.
mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
@nm3mon
nm3mon / latest_timestamp
Created January 17, 2014 16:31
Git show latest commit timestamp on all branches
git for-each-ref --shell --format="echo %(refname:short) && git log -n 1 --format=format:\" %%cd%%n %%B\" %(refname)" refs/ | sh
@nm3mon
nm3mon / Info.plist
Created December 9, 2013 15:38
Intellij idea vmoptions
<string>-Xms512m -Xmx860m -XX:MaxPermSize=250m -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts -XX:+CMSClassUnloadingEnabled -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0 -XX:-TraceClassUnloading -Dfile.encoding=UTF-8 -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+UseCodeCacheFlushing -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -Xverify:none -Xbootclasspath/a:../lib/boot.jar</string>
package main
import (
"fmt"
"bufio"
"os"
"log"
"io"
)
static int mystery(int a, int b) {
if (b == 0) return 0;
if (b % 2 == 0) return mystery(a + a, b / 2);
return mystery(a + a, b / 2) + a;
}
static class Node {
int key;
String name;
Node next;
Node[] children;
Node(int key, String name) {
this.key = key;
this.name = name;
}
@nm3mon
nm3mon / BacktrackingCharFiltering.java
Created August 16, 2013 15:38
Remove some chars from a singly-linked list of chars using a backtracker.
class BacktrackingCharFiltering {
static class Node<E> {
Node<E> next;
E data;
Node(E data) {
this.data = data;
}
}
class Node<E> {
E data;
Node<E> left;
Node<E> right;
Node<E> parent;
E getData() {return data;}
Node<E> leftChild() {return this.left;}
Node<E> rightChild() {return this.right;}
Node<E> parent() {return this.parent;}
class Node<E> {
E data;
Node<E> left;
Node<E> right;
E getData() {return data;}
Node<E> leftChild() {return this.left;}
Node<E> rightChild() {return this.right;}
}
static <T> void iterateBSTInOrder(Node<T> node) {