Skip to content

Instantly share code, notes, and snippets.

@esamson
esamson / .gitignore
Last active Jun 21, 2020
Podman services
View .gitignore
container-*.service
@esamson
esamson / home-backup.sh
Created Dec 2, 2019
borg backup script
View home-backup.sh
#!/bin/sh
#
# Daily backup job.
# Belongs in /etc/cron.daily/
# Back up /home partition to /media/backup partition.
SRC=/home/
DEST=/media/backup/bomuhei/
LOG=/media/backup/last_backup.bomuhei
@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
You can’t perform that action at this time.