This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Sometimes you might want to rethrow the same exception but with a little extra in the message. This allows | |
* you to "clone" an exception but change the message. (C# exceptions have the capability to hold arbitrary | |
* information via the `Data` property (a `Dictionary`).) | |
*/ | |
@NonNull | |
public static Throwable replaceMessageOf(@NonNull final Throwable ex, @NonNull final String msg) { | |
// First try using reflection to just stomp on the exception instance's message | |
if (false) { | |
final var rex = stompOnMessageOf(ex, msg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Looks like this: | |
{"todo":[ | |
{"isbn":"0064632105"}, | |
{"isbn":"007001115X"}, | |
{"isbn":"0070079749"}, | |
... | |
*/ | |
public static class OneArrayElementPerLineNoWhitespacePrettyPrinter extends DefaultPrettyPrinter { | |
public OneArrayElementPerLineNoWhitespacePrettyPrinter() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2023 Bakin's Bits | |
* | |
* 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 without limitation the rights to use, copy, modify, | |
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | |
* permit persons to whom the Software is furnished to do so, subject to the following | |
* conditions: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Electrum's "History" page - showing transactions in and out - has a total at the bottom called "Balance", which, | |
obviously, shows how much BTC is in the wallet. | |
Except it doesn't. Because it doesn't include any amount that is in change addresses. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
# O'Dwyer's Auto macro - hygenic scope guard w/ zero overhead | |
# https://quuxplusone.github.io/blog/2018/08/11/the-auto-macro/ | |
# | |
# "This scope guard has perfect codegen with zero overhead (at `-O2`) on all major compilers." | |
# "Because it requires no explicit captures, no novel variable name, no special treatment for `this`, | |
# it is highly suited for mechanically generated code." | |
# "It is portable all the way back to C++11." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
// Template which inherits from its own specialization, as I first saw in | |
// https://stackoverflow.com/a/28213747/751579, which surprised me | |
template <typename T> | |
struct Foo : public Foo<decltype(T::x)> { | |
T xxx; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Grab list of all kindle books purchased from the currently logged in | |
// Amazon account. Lets you save this list as a JSON file. | |
// The following data should be run in the console while viewing the page https://read.amazon.com/ | |
// Kindle booklist fetch derived from jkubecki/ExportKindle.js | |
// (https://gist.github.com/jkubecki/d61d3e953ed5c8379075b5ddd8a95f22) | |
// console.save grabbed from DevTools Snipppets | |
// (https://bgrins.github.io/devtools-snippets/#console-save) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"globals": { | |
"alwaysShowTabs": true, | |
"defaultProfile": "{79285a8e-036c-446f-8a9c-78994e34cf85}", | |
"initialCols": 120, | |
"initialRows": 30, | |
"requestedTheme": "dark", | |
"keybindings": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bakins_bits; | |
import static org.assertj.core.api.Assertions.assertThat; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Set; | |
import java.util.function.BiConsumer; | |
import java.util.function.BinaryOperator; | |
import java.util.function.Function; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bakins_bits.types; | |
import java.util.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Supplier; | |
import org.apache.commons.lang3.builder.EqualsBuilder; | |
import org.apache.commons.lang3.builder.HashCodeBuilder; | |
import com.google.common.base.Preconditions; |
NewerOlder