Skip to content

Instantly share code, notes, and snippets.

naaman / gist:1053217
Created Jun 29, 2011
Hot Swapping With Maven, Jetty and IntelliJ
View gist:1053217

Hot Swapping With Maven, Jetty and IntelliJ

Based on Configuring Jetty, Maven, and Eclipse together with Hot Swap

I've always been a bit jealous when it comes to the Play! framework and the great dev mode they have for hot swapping classes at runtime. Jetty has a configuration setting, scanIntervalSeconds, that mimics this when working with a more traditional WAR, but does so by looking for changes to a file and restarting the server.

Fortunately, Jetty also provides the ability to rapidly test code with hot swapping. No more server restarts. The trick to getting hot swapping to work is to attach a remote debugger to your Jetty process. The following instructions outline how to do this in IntelliJ (tested with IDEA 10.5 CE).

Modify your jetty-maven-plugin to ignore the scan interval

  1. Open your pom and locate the plugins section
naaman /
Last active Mar 5, 2021
[WARNING THIS WILL HARD DELETE YOUR APPS. YOU COULD LOSE DATA. MAKE SURE YOU KNOW WHAT YOURE DOING!!!!!!!!!!] Delete all heroku apps from bash terminal -- no script file required
for app in $(heroku apps); do heroku apps:destroy --app $app --confirm $app; done
#!/usr/bin/env bash
mkdir vim
curl --location --silent | tar xz -C vim
export PATH=$PATH:/app/vim/bin
naaman /
Created May 11, 2012
Open iTerm2 Pane and Execute a Command
pane() {
local currentDir=$(pwd)
osascript <<EOD
tell application "iTerm"
tell application "System Events" to keystroke "d" using command down
tell current session of current terminal
write text "cd $currentDir"
write text "$@"
end tell
end tell
naaman / network-interface-patch-notes
Last active Dec 15, 2015
Notes on patching NetworkInterface.c
View network-interface-patch-notes
$ find . -name NetworkInterface.c
$ cp ./openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c ./NetworkInterface.c
$ vi NetworkInterface.c
note: fscanf should only match one line
replace first 02x with 08x
naaman / 8009591-network_interface.patch
Last active Dec 15, 2015
JDK NetworkInterface Linux Patch
View 8009591-network_interface.patch
--- ./openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c 2013-03-04 21:51:01.000000000 +0000
+++ ./openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c 2013-04-02 22:35:56.000000000 +0000
@@ -1127,7 +1127,7 @@
uint8_t ipv6addr[16];
if ((f = fopen(_PATH_PROCNET_IFINET6, "r")) != NULL) {
- while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
+ while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n",
addr6p[0], addr6p[1], addr6p[2], addr6p[3], addr6p[4], addr6p[5], addr6p[6], addr6p[7],
&if_idx, &plen, &scope, &dad_status, devname) != EOF) {
java -version 2>&1 | head -1 | sed "s/[^0-9\.\_\-]*//g"
naaman / gist:5095220
Created Mar 5, 2013
anorm hack to use row cursors
View gist:5095220
// hack to get a Stream with a cursor-backed query because anorm doesn't combine the two
private def resultSetToStream(sql: SimpleSql[Row])(implicit c: Connection): Stream[SqlRow] = {
val stmt = sql.getFilledStatement(c, getGeneratedKeys = false)
val rs = stmt.executeQuery()
val rsMetaData = Sql.metaData(rs)
val columns = List.range(1, rsMetaData.columnCount + 1)
def data(rs: java.sql.ResultSet) = => rs.getObject(nb))
Useful.unfold(rs)(rs => if (! { rs.getStatement.close(); None } else Some((new SqlRow(rsMetaData, data(rs)), rs)))
naaman / gist:4993390
Created Feb 20, 2013
jdk dyno scratch
View gist:4993390
1 ls -lah
2 curl -O
3 tar xvzf icedtea-2.1.5.tar.gz
4 cd icedtea-2.1.5
5 ./configure --with-parallel-jobs=2 --disable-docs --disable-bootstrap --with-jdk-home=/usr/lib/jvm/java-6-openjdk
6 cd ..
7 curl -O
8 tar xf apache-ant-1.8.4-bin.tar.gz
9 ls -lah
10 ls -lah apache-ant-1.8.4
public class SecurityListings {
public static void main(String[] args) {
for (Provider provider : Security.getProviders()) {
System.out.println("Provider: " + provider.getName());
for (Provider.Service service : provider.getServices()) {
System.out.println(" Algorithm: " + service.getAlgorithm());