Skip to content

Instantly share code, notes, and snippets.

@esamson
esamson / .gitignore
Last active April 28, 2019 14:56
systemd service file for sonatype nexus. Put this in `$HOME/.config/systemd/user/nexus.service`. Launch with `systemctl --user start nexus`.
default.target.wants/
nexus
@esamson
esamson / swapescape.sh
Created December 16, 2014 01:14
Swap Escape and CAPS LOCK keys
dconf write /org/gnome/desktop/input-sources/xkb-options "['caps:swapescape']"
@esamson
esamson / tmux-window-titles-fix.sh
Created February 19, 2015 09:25
Workaround for tmux window titles in Fedora 21. See: https://bugzilla.redhat.com/show_bug.cgi?id=969429#c27
#!/bin/bash
sudo ln -s /usr/bin/true /etc/sysconfig/bash-prompt-screen
@esamson
esamson / opendj
Created February 19, 2015 09:33
OpenDJ subcommands -- instead of adding everything to your PATH
#!/bin/bash
OPENDJ_HOME=~/.local/opt/opendj
if [ -z "$1" ] ; then
echo "Usage: $0 <command>"
echo
echo "Where <command> is one of:"
echo
ls -1 $OPENDJ_HOME/bin
@esamson
esamson / current-workspace-only.sh
Created February 20, 2015 03:08
Set Gnome 3 app switcher to only consider the current workspace
gsettings set org.gnome.shell.app-switcher current-workspace-only true
@esamson
esamson / purge.sh
Last active August 29, 2015 14:16 — forked from adrienbrault/purge.sh
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
@esamson
esamson / Dockerfile
Created March 6, 2015 07:27
Dockerfile for a Vagrant ready image. Kinda works but getting permission denied errors in the synced folder (e.g., `/vagrant`).
FROM centos:7
RUN yum install -y openssh-server openssh-clients sudo
RUN yum clean all
RUN sed -ri 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config
RUN sed -i "s/Defaults requiretty.*/#Defaults requiretty/g" /etc/sudoers
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
RUN ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ''
RUN useradd vagrant
@esamson
esamson / Secret.java
Created May 23, 2015 09:57
Clearing a Java String
import java.lang.reflect.Field;
import java.io.Console;
public class Secret {
public static void main(String[] args) throws Exception {
Console console = System.console();
String secret = console.readLine("secret: ");
System.out.println("Capture secret in heap");
@esamson
esamson / PlantUmlSkinParams.java
Created August 26, 2015 06:12
Dump all PlantUML skinparams to standard output as a nested structure. Use as a starting point for defining a custom PlantUML skin.
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.Ordering;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.TreeSet;
import net.sourceforge.plantuml.SkinParam;
/**
@esamson
esamson / PlantUML beta fix.md
Last active August 27, 2015 02:02
PlantUML v8029 fix for skinparam FrameBorderColor

From PlantUML Q&A. This fixes the issue where defining different border colors with stereotypes has no effect:

skinparam frame {
    borderColor Yellow
    borderColor<<good>> Green
    borderColor<<bad>> Red
}