Skip to content

Instantly share code, notes, and snippets.

View JerryPreissler's full-sized avatar

Jerry Preissler JerryPreissler

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jerrypreissler on github.
  • I am gpreissler (https://keybase.io/gpreissler) on keybase.
  • I have a public key whose fingerprint is 2CAE 442D BD8F 6432 F0F8 68E9 C678 A1B0 1AD0 2EE1

To claim this, I am signing this object:

@JerryPreissler
JerryPreissler / Dockerfile
Created June 8, 2014 21:36
Dockerfile to set up Typesafe Activator in a Docker image
# requires https://gist.github.com/JerryPreissler/40df842eb5ac48644479
FROM jerry/javadev
MAINTAINER Jerry Preissler, jerry@codeshards.org
RUN \
wget --directory-prefix=/tmp http://downloads.typesafe.com/typesafe-activator/1.2.2/typesafe-activator-1.2.2.zip && \
cd /opt && unzip /tmp/*.zip && \
chmod ugo+x $(ls -d -1 $PWD/**)/activator && \
echo "export PATH=$PATH:"$(ls -d -1 $PWD/**) >> /home/develop/.profile
@JerryPreissler
JerryPreissler / gist:fa1ea424abf00e571606
Last active August 29, 2015 14:02
Sample output for 'docker ps -a'
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ae5e96bed377 ubuntu:latest /bin/bash About an hour ago Exited (0) About an hour ago jolly_rosalind
b76bf6309025 ubuntu:latest /bin/bash About an hour ago Exited (127) 53 minutes ago condescending_carson
@JerryPreissler
JerryPreissler / Dockerfile with Oracle JDK
Created June 8, 2014 15:43
A Dockerfile to create an Ubuntu image with Oracle JDK und Maven already installed
FROM ubuntu
MAINTAINER Jerry Preissler, jerry@codeshards.org
RUN \
apt-get update && \
apt-get install -y software-properties-common
# install Oracle JDK and Maven
RUN \
@JerryPreissler
JerryPreissler / gist:6506168
Created September 10, 2013 07:42
ssh tunnel without login shell
The problem: provide a user that can tunnel to a given host via ssh, but not log in or copy files from the host
Solution:
1. Create user with adduser
2. Set shell for user to /bin/rbash (restricted shell, caution: this does not provide sufficient security by itself)
3. In user's home edit .profile: set path to home dir only
4. create <userhome>/.ssh/authorized_keys, chown -R user:user .ssh, chmod -R go-rwx .ssh
5. insert user's ssh public key into authorized_keys
6. set ssh permissions for this key in authorized_keys (see 'man authorized_keys') for details
@JerryPreissler
JerryPreissler / maven_require.rb
Created June 25, 2013 19:03
Short jruby function to require all jar files from a maven classpath.
# Require the jar files from a Maven classpath in JRuby
#
# ==== Attributes
# * +path+ to the project root directory where Maven should be run
#
def maven_require(path)
save_dir = Dir.getwd
throw "could not change to dir #{path}" unless Dir.exists?(path)
begin
Dir.chdir(path)
@JerryPreissler
JerryPreissler / gist:5795934
Last active December 18, 2015 14:18
Configure remote debugging when running application (e.g. Jetty) via Maven plugin
Set the maven opts via an environment variable (sample is for bash, adapt as needed):
export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"
Start the application, e.g. via
mvn jetty:run
The application should wait for a debug connection with the following message:
@JerryPreissler
JerryPreissler / gist:5634944
Created May 23, 2013 09:37
Rails: file upload to specific path
<%= form_tag "/path/data.json", {method: "put", multipart: true} do %>
<%= file_field_tag :data %>
<%= submit_tag "upload" %>
<% end %>