Skip to content

Instantly share code, notes, and snippets.

@bigcurl
bigcurl / app.rb
Created April 8, 2009 14:35
Bringing up a Sinatra app. Thanks to Ola Bini for the split script.
require 'rubygems'
require 'sinatra'
get '/' do
"Hello from Sinatra running on Java!"
end
@headius
headius / pickjdk.sh
Last active August 30, 2015 13:15 — forked from nicksieger/pickjdk.sh
JDK picker for OS X.
#!/bin/bash
#
# Provides a function that allows you to choose a JDK. Just set the environment
# variable JDKS_ROOT to the directory containing multiple versions of the JDK
# and the function will prompt you to select one. JAVA_HOME and PATH will be cleaned
# up and set appropriately.
# Usage:
# Include in .profile or .bashrc or source at login to get 'pickjdk' command.
# 'pickjdk' alone to bring up a menu of installed JDKs on OS X. Select one.
#!/bin/sh
# simple script for turning a jar with a Main-Class
# into a stand alone executable
# cat [your jar file] >> [this file]
# then chmod +x [this file]
# you can now exec [this file]
commandToRun="$(printf "%q " "$@")"
if test "$commandToRun" = "'' "; then
eval "exec java -Xmx1G -jar $0"
else
@exoer
exoer / db_server.rb
Created July 4, 2011 17:58 — forked from coderanger/db_server.rb
Create postgres users and databases from Chef
include_recipe "postgresql::server90"
# inspiration from
# https://gist.github.com/637579
execute "create-root-user" do
code = <<-EOH
psql -U postgres -c "select * from pg_user where usename='root'" | grep -c root
EOH
command "createuser -U postgres -s root"
@johnthethird
johnthethird / server.log
Created December 3, 2011 03:37
Torquebox error: (LoadError) library `fcntl' could not be loaded: java.lang.NullPointerException
## SOLUTION
I was able to get past the error by putting this line at the top of config/application.rb
require 'fcntl'
##
torquebox-2.0.0.beta1
$ uname -a
Darwin JohnsAir.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64
@jcrossley3
jcrossley3 / todo.org
Created January 24, 2012 16:55
Simulated clustering

To test clustering using a single JBoss instance on a single server, use the properties jboss.node.name, jboss.server.data.dir, and jboss.socket.binding.port-offset

In one shell, run

$JBOSS_HOME/bin/standalone.sh --server-config=standalone-ha.xml -Djboss.node.name=one -Djboss.server.data.dir=/tmp/one

In another, run

$JBOSS_HOME/bin/standalone.sh --server-config=standalone-ha.xml -Djboss.node.name=two -Djboss.server.data.dir=/tmp/two -Djboss.socket.binding.port-offset=100
@nicksieger
nicksieger / jruby.sh
Created March 15, 2012 16:20
JRuby launcher script to use in Warbler war files
#!/bin/sh
#
# Simple script to launch JRuby using the components embedded in a war created by Warbler.
# Tell Warbler to put this script in /WEB-INF with this config/warble.rb code:
#
# config.webinf_files += FileList["jruby.sh"]
#
HERE=`dirname $0`
GEM_HOME=$HERE/gems
@qmx
qmx / HelloJite.java
Created September 23, 2013 18:21
Jitescript with macros
package me.qmx.jipsy;
import me.qmx.jitescript.CodeBlock;
import me.qmx.jitescript.JiteClass;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@cobyism
cobyism / osx-install-media.md
Last active March 11, 2023 00:42
Command to create installable OS X USB drive.

Creating a bootable macOS USB installer

  • First, plug in an 8GB (or bigger) USB drive, and use Disk Utility to erase it
  • If you use the default settings, you should wind up with a blank drive at /Volumes/Untitled.

With that volume in place, and with the macOS installer sitting in /Applications/Install\ macOS\ [VERSION].app, run the following command in your terminal to create a bootable install media (for Sierra):

sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ macOS\ Sierra.app --nointeraction
@hunterloftis
hunterloftis / gist:1e42a29491330f89ae36
Created August 24, 2015 18:06
problems with CLI buildpacks array manipulation
  1. The add/set commands are ambiguous and confusing
  2. Forking/cloning requires a sometimes-long sequence of tedious add/set/clear commands
  3. The list of buildpacks isn't carried with the files in a repo

what does buildpacks:set do?

Can you set the whole list at once, eg heroku buildpacks:set url1, url2, url3? Or does it only set the final buildpack? If you have a previously defined list, what does :set do? Does it replace the final buildpack, or blow away the whole list, or error?