Skip to content

Instantly share code, notes, and snippets.

View rynmrtn's full-sized avatar

Ryan Morton rynmrtn

View GitHub Profile

Enable Remote Debugging on a Java Server

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5001

The best documentation on this is available from InformIT. This site details the following parameters:

  • -Xdebug : Enables the application to be debugged.
  • -Xnoagent : Disables the sun.tools.debug agent so that the JPDA debugger can properly attach its own agent.
  • -Djava.compiler=NONE : Disables the JIT (Just-In-Time) compiler.
  • -Xrunjdwp : Loads the reference implementation of the Java Debug Wire Protocol, which enables remote debugging.
@rynmrtn
rynmrtn / collections.scala
Created December 12, 2009 19:49
Notes on Scala Collections
/*
Notes on Collections
By default, Scala uses immutable collections. However, there are mutable
versions available (in the scala.collection.mutable package). The most common
collections are List, Set, and Map.
*/
// Declaring a set
val urls = Set("google.com", "yahoo.com", "nytimes.com")
@rynmrtn
rynmrtn / traits.scala
Created December 11, 2009 02:42
Scala Traits
/*
Playing with Scala Traits, a nice way to add (mixin) functionality
to classes using the decorator pattern.
With traits, the evaluation occurs left to right. Traits can be
applied to class/trait definitions in addition to objects, as
demonstrated by the class ContinuousIntegration
*/
class Test {
def test() : String = "Testing... "
#
# Check if files/directories exist
if [ -f file ]; then
echo "file exists"
fi
if [ -d dir ]; then
echo "dir exists"
fi
# Create an associative array of options/values
@options = {"Select Something" => 0, "Cat" => 1,
"Dog" => 2}
@value = 1
$ rsync -avz -e ssh username@remote.server:/remote/dir /local/dir
@rynmrtn
rynmrtn / gist:168084
Created August 14, 2009 20:26
Backup Subversion Repository
$ svnadmin dump /repo/dir > repo.dump
# Change VBox UUID
$ VBoxManage internalcommands setvdiuuid diskName.vdi
@rynmrtn
rynmrtn / rails_cheat.rb
Created August 1, 2009 16:40
Cheat sheet for Rails Development
###
# Migrations
# data_types = {:string, :text, :integer, :float, :decimal, :datetime, :timestamp,
# :time, :date, :binary, :boolean }
# Add a Column
add_column :table_name, :column_name, :data_type, :options
# Remove a Column
remove_column :table_name, :column_name
In rails, -%> can remove any newline that follows the output.