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
#!/usr/bin/env bash | |
# Show current branch for all repos under current directory (avoids submodules) | |
for repo in $(find . -type d -execdir test -d {}/.git \; -prune -print | sed 's/^\.\///g' | sort); | |
do | |
cd $repo | |
branch=$(git branch --show-current) | |
echo "$repo = $branch" | |
cd $OLDPWD |
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
[ | |
{ | |
"name": "UHK" | |
}, | |
[ | |
{ | |
"c": "#459896" | |
}, | |
"~\n\n\n\n\n\n`\n\n\n\nesc", | |
{ |
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
OUT=fileCreateTransactions.json | |
MNODE=https://mainnet-public.mirrornode.hedera.com | |
echo '[' > $OUT | |
R=$(curl -S -s "${MNODE}/api/v1/transactions?transactionType=FILECREATE&result=success&order=asc") | |
echo ${R} , >> $OUT | |
while NEXT=$(echo $R | jq --exit-status --raw-output ' .links.next') | |
do |
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
private void removeLogging() { | |
final var ctx = (org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false); | |
final var configuration = (AbstractConfiguration) ctx.getConfiguration(); | |
final var allAppenders = configuration.getAppenders(); | |
for (final var appenderName : allAppenders.keySet()) { | |
configuration.removeAppender(appenderName); | |
} | |
} |
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
private Object copy(final Object src) { | |
byte[] intermediate = null; | |
try (final var bos = new ByteArrayOutputStream(); | |
final var oos = new ObjectOutputStream(bos)) { | |
oos.writeObject(src); | |
oos.flush(); | |
intermediate = bos.toByteArray(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
return null; |
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
@Test | |
void loggingCaptureTest() { | |
final var log = (org.apache.logging.log4j.core.Logger)LogManager.getLogger(Foobar.class); // whatever you use to get a logger | |
CharArrayWriter outContent = new CharArrayWriter(); | |
StringLayout layout = PatternLayout.newBuilder().withPattern("%-5level %msg").build(); | |
Appender appender = WriterAppender.newBuilder().setTarget(outContent).setLayout(layout).setName("TEST").build(); | |
appender.start(); | |
log.addAppender(appender); | |
log.setLevel(Level.DEBUG); |
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
From tutorial at https://docs.hedera.com/hedera/getting-started/try-examples/deploy-your-first-smart-contract |