Skip to content

Instantly share code, notes, and snippets.

@Crydust
Crydust / .abcde.conf
Last active December 30, 2025 22:34
Rip audio cds
# Custom settings for abcde version 2.8.2
# sudo dnf install abcde lame flac eyeD3 id3v2
# getalbumart requires glyrc, which you can install on fedora from files downloaded here:
# https://packages.fedoraproject.org/pkgs/glyr/glyr/
# If you want to edit the id3 info: sudo install exfalso
# CDDB options
# Choose whether you want to use "cddb", "musicbrainz" and/or
# "cdtext". Default is "musicbrainz", but all can be specified in a
@Crydust
Crydust / compresspdf.sh
Created June 10, 2025 20:56
Compress pdf with gostscript on linux command line
#!/bin/sh
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed.pdf inpu.pdf
@Crydust
Crydust / ConvertPocketCsvExportToBookmarksHtml.java
Created May 31, 2025 14:43
Convert Pocket Csv Export To Bookmarks Html
package be.crydust;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import org.apache.commons.text.StringEscapeUtils;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
@Crydust
Crydust / WriteXml.java
Created May 11, 2025 16:18
Read and write xml with whitespace in an attribute.
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.Transformer;
@Crydust
Crydust / ShowGeometry.java
Last active April 17, 2025 21:51
Initialize Graphics2D with highest visual quality and draw jts Geometry objects
private static void show(Geometry... geometries) throws InterruptedException, InvocationTargetException {
ShapeWriter shapeWriter = new ShapeWriter(createPointTransformation(5, 20));
int width = 640, height = 480;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = createGraphics2D(image);
try {
// Draw background
g2d.setColor(Color.WHITE);
@Crydust
Crydust / XmlStax.java
Last active August 30, 2023 14:03
Read xml using stax api in java
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.events.EndElement;

Git worktree

# clone the repo, but switch it to a dummybranch so other worktrees can checkout the main branch
git clone --no-checkout URL_HERE repo.git
cd repo.git
git switch -c dummy

# add a worktree
git worktree add ../repo_main main
@Crydust
Crydust / my-winutil.ps1
Created February 18, 2023 16:44
remove junk from windows 10
Write-Host "Creating Restore Point in case something bad happens"
Enable-ComputerRestore -Drive "$env:SystemDrive"
Checkpoint-Computer -Description "RestorePoint1" -RestorePointType "MODIFY_SETTINGS"
#WPFEssTweaksDVR
If (!(Test-Path "HKCU:\System\GameConfigStore")) {
New-Item -Path "HKCU:\System\GameConfigStore" -Force
}
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_DXGIHonorFSEWindowsCompatible" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_HonorUserFSEBehaviorMode" -Type DWord -Value 1
@Crydust
Crydust / transparent-pixel.html
Created February 8, 2023 13:13
transparent pixel
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/>