Skip to content

Instantly share code, notes, and snippets.

@jesustorresdev
jesustorresdev / base64.h
Last active March 28, 2023 21:27 — forked from tomykaira/Base64.h
C++20 constexpr single header base64 decode/encoder.
#ifndef _MACARON_BASE64_H_
#define _MACARON_BASE64_H_
/**
* The MIT License (MIT)
* Copyright (c) 2016 tomykaira
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@adamcbuckley
adamcbuckley / VersionNumberComparator.java
Created January 16, 2020 17:37
A java.util.Comparator for version (or chapter) numbers, which have an arbitrary number of decimal points.
package com.hebdensoft;
import java.util.Comparator;
/**
* <p>A java.util.Comparator for version (or chapter) numbers, which have an arbitrary number of decimal points.</p>
* <p>The code was taken from https://bugs.openjdk.java.net/browse/JDK-8134512 and http://cr.openjdk.java.net/~igerasim/8134512/04/webrev/index.html</p>
* <p>How to use:</p>
* <p><code>myListOfVersionNumbers.sort(VersionNumberComparator.getInstance());</code></p>
@raymyers
raymyers / ShellSplitter.java
Last active April 7, 2024 19:11
Simple Java program to tokenize string as a shell would - similar to shlex in Python. Not checked for POSIX compliance yet - feel free to comment with edge cases that could be fixed. This is my original work, free to reuse. Created for Stack Overflow question: https://stackoverflow.com/questions/1082953/shlex-alternative-for-java/20725050:
package com.cadrlife;
import java.util.ArrayList;
import java.util.List;
public class ShellSplitter {
public List<String> shellSplit(CharSequence string) {
List<String> tokens = new ArrayList<String>();
boolean escaping = false;
char quoteChar = ' ';