Skip to content

Instantly share code, notes, and snippets.

Edward Samson esamson

Block or report user

Report or block esamson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@esamson
esamson / calibre-install-user.sh
Created Nov 10, 2018
Install Calibre on Linux without sudo
View calibre-install-user.sh
wget https://download.calibre-ebook.com/linux-installer.sh
sh linux-installer.sh install_dir=~/.local/opt isolated=True
@esamson
esamson / retext
Created Aug 23, 2018
Reencode text file character set and line endings.
View retext
#!/usr/bin/env amm
import $ivy.`com.github.pathikrit::better-files:3.5.0`
import $ivy.`commons-io:commons-io:2.6`
import java.io.{BufferedReader, InputStreamReader, PrintWriter}
import java.nio.charset.{Charset, StandardCharsets}
import ammonite.ops._
import better.files._
import org.apache.commons.io.ByteOrderMark
View Solarized Dark (Darcula).icls
<scheme name="Solarized Dark (Darcula)" version="142" parent_scheme="Darcula">
<option name="EDITOR_FONT_SIZE" value="12" />
<option name="CONSOLE_FONT_NAME" value="Menlo" />
<option name="EDITOR_FONT_NAME" value="Monaco" />
<colors>
<option name="ADDED_LINES_COLOR" value="baffba" />
<option name="ANNOTATIONS_COLOR" value="586e75" />
<option name="ANNOTATIONS_MERGED_COLOR" value="2aa198" />
<option name="CARET_COLOR" value="eee8d5" />
<option name="CARET_ROW_COLOR" value="73642" />
View google-chrome.desktop.patch
--- original/google-chrome.desktop
+++ fixed/google-chrome.desktop
@@ -112,6 +112,7 @@
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;
X-Ayatana-Desktop-Shortcuts=NewWindow;NewIncognito
+StartupWMClass=Google-chrome-stable
[NewWindow Shortcut Group]
Name=New Window
@esamson
esamson / PlantUML beta fix.md
Last active Aug 27, 2015
PlantUML v8029 fix for skinparam FrameBorderColor
View PlantUML beta fix.md

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
}
@esamson
esamson / PlantUmlSkinParams.java
Created Aug 26, 2015
Dump all PlantUML skinparams to standard output as a nested structure. Use as a starting point for defining a custom PlantUML skin.
View PlantUmlSkinParams.java
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 / Secret.java
Created May 23, 2015
Clearing a Java String
View Secret.java
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 / Dockerfile
Created Mar 6, 2015
Dockerfile for a Vagrant ready image. Kinda works but getting permission denied errors in the synced folder (e.g., `/vagrant`).
View Dockerfile
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
View 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 / current-workspace-only.sh
Created Feb 20, 2015
Set Gnome 3 app switcher to only consider the current workspace
View current-workspace-only.sh
gsettings set org.gnome.shell.app-switcher current-workspace-only true
You can’t perform that action at this time.