Skip to content

Instantly share code, notes, and snippets.

@esamson
esamson / InYourProcessor.java
Last active May 2, 2022 12:12
Maven and javax.annotation.processing.Messager NOTE messages.
import javax.annotation.processing.SupportedOptions;
@SupportedOptions("debug") // declare the `debug` option
public final class InYourProcessor extends AbstractProcessor {
/**
* This is now your logging routine.
*/
private void log(String msg) {
if (processingEnv.getOptions().containsKey("debug")) {
@esamson
esamson / calibre-install-user.sh
Created November 10, 2018 10:45
Install Calibre on Linux without sudo
wget https://download.calibre-ebook.com/linux-installer.sh
sh linux-installer.sh install_dir=~/.local/opt isolated=True
@esamson
esamson / .gitignore
Last active June 21, 2020 00:47
Podman services
container-*.service
@esamson
esamson / home-backup.sh
Created December 2, 2019 21:23
borg backup script
#!/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 / .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 / utf8ify.py
Created July 12, 2012 09:23
Use chardet to guess a file's encoding and then iconv to convert the file to UTF-8
#!/usr/bin/env python
import sys
import urllib
import chardet
import os
orig = sys.argv[1]
rawdata = urllib.urlopen(orig).read()
enc = chardet.detect(rawdata)['encoding']
@esamson
esamson / retext
Created August 23, 2018 23:20
Reencode text file character set and line endings.
#!/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
@esamson
esamson / Solarized Dark (Darcula).icls
Last active February 9, 2017 05:34
Solarized Colorscheme for IntelliJ IDEA (from https://github.com/jkaving/intellij-colors-solarized )
<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" />
@esamson
esamson / slf4j.tmpl
Created January 20, 2013 14:23
Improved NetBeans code template for generating an SLF4J Logger declaration. See http://wiki.netbeans.org/SLF4JCodeTemplate for instructions on how to use.
private static final ${LOG_TYPE type="org.slf4j.Logger" default="Logger" editable=false} log =
${LOG_FACT type="org.slf4j.LoggerFactory" default="LoggerFactory" editable=false}.getLogger(${classVar editable="false" currClassName default="getClass()"}.class);
@esamson
esamson / Stinger-2.2-2.2.2.diff
Created November 12, 2013 01:35
Source file changes between Stinger-2.2 and Stinger-2.2.2
diff -ur Stinger-2.2/src/org/owasp/stinger/Stinger.java Stinger-2.2.2/src/org/owasp/stinger/Stinger.java
--- Stinger-2.2/src/org/owasp/stinger/Stinger.java 2006-11-21 21:11:16.000000000 +0800
+++ Stinger-2.2.2/src/org/owasp/stinger/Stinger.java 2007-12-20 11:04:30.000000000 +0800
@@ -44,12 +44,15 @@
private static RuleSet set = null;
+ private static boolean debug = false;
+
private Stinger() {