This file contains hidden or 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
| async function generateOneTimePassword(rawKey: Uint8Array, counter: number): Promise<number> { | |
| const data = new DataView(new ArrayBuffer(8)); | |
| data.setBigUint64(0, BigInt(Math.floor(counter)), false); | |
| const algo = { name: 'HMAC', hash: 'SHA-1' }; | |
| const key = await crypto.subtle.importKey('raw', rawKey, algo, false, ['sign']); | |
| const hmacHash = new Uint8Array(await crypto.subtle.sign(algo, key, data.buffer)); | |
| const offset = hmacHash[hmacHash.byteLength - 1] & 0x0f; | |
| const hotp = (hmacHash[offset] & 0x7f) << 24 |
This file contains hidden or 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 io.github.matteobertozzi; | |
| import java.lang.System.Logger; | |
| import java.lang.System.Logger.Level; | |
| import java.lang.management.ManagementFactory; | |
| import java.net.URI; | |
| import java.net.http.HttpClient; | |
| import java.net.http.HttpRequest; | |
| import java.net.http.HttpRequest.BodyPublishers; | |
| import java.net.http.HttpResponse; |
This file contains hidden or 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
| public class EnumLruMapping { | |
| private static final int MIN_ENUM_STRING_LENGTH = 3; | |
| private static final int MAX_INDEX_LENGTH = 0xffff; | |
| private final int lruSize; | |
| private final int minFreq; | |
| private ItemNode[] buckets; | |
| private ItemNode[] indexed; | |
| private ItemNode lruHead; |
This file contains hidden or 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 python | |
| # ---------------------------------------------------------------------- | |
| # Copyright 2022 Matteo Bertozzi | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # |
This file contains hidden or 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
| java.lang.AssertionError: org.graalvm.polyglot.Value should not be reachable | |
| at org.graalvm.truffle/com.oracle.truffle.polyglot.ObjectSizeCalculator.isContextHeapBoundary(ObjectSizeCalculator.java:272) | |
| at org.graalvm.truffle/com.oracle.truffle.polyglot.ObjectSizeCalculator.canProceed(ObjectSizeCalculator.java:333) | |
| at org.graalvm.truffle/com.oracle.truffle.polyglot.ObjectSizeCalculator.access$500(ObjectSizeCalculator.java:87) | |
| at org.graalvm.truffle/com.oracle.truffle.polyglot.ObjectSizeCalculator$ArrayElementsVisitor.visit(ObjectSizeCalculator.java:354) | |
| at org.graalvm.truffle/com.oracle.truffle.polyglot.ObjectSizeCalculator.visit(ObjectSizeCalculator.java:244) | |
| at org.graalvm.truffle/com.oracle.truffle.polyglot.ObjectSizeCalculator.calculateObjectSize(ObjectSizeCalculator.java:207) | |
| at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.calculateHeapSize(PolyglotContextImpl.java:1645) | |
| at org.graalvm.truffle/com.oracle.truffle.polyglot.EngineAccessor$EngineImpl.calculateContextHeapSize(Eng |
This file contains hidden or 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 test.netty; | |
| import io.netty.channel.epoll.Epoll; | |
| public class App { | |
| public static void main(String[] args) { | |
| if (Epoll.isAvailable()) { | |
| System.out.println("ALL GOOD: epoll is Available"); | |
| } else { | |
| System.out.println("NOT GOOD: epoll is NOT Available"); |
This file contains hidden or 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 python3 | |
| from struct import pack, unpack | |
| from base64 import b64encode | |
| from hashlib import sha1 | |
| import asyncio | |
| async def _ws_handle_handshake(reader, writer): | |
| data = await reader.read(1024) |
This file contains hidden or 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
| diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java | |
| index 44b2641c6..a0ca4ff1a 100644 | |
| --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java | |
| +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java | |
| @@ -1467,7 +1467,7 @@ public class HttpPostMultipartRequestDecoder implements InterfaceHttpPostRequest | |
| valueStart = HttpPostBodyUtil.findNonWhitespace(sb, colonEnd); | |
| valueEnd = HttpPostBodyUtil.findEndOfString(sb); | |
| headers.add(sb.substring(nameStart, nameEnd)); | |
| - String svalue = sb.substring(valueStart, valueEnd); | |
| + String svalue = sb.substring(valueStart, Math.max(valueStart, valueEnd)); |
This file contains hidden or 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
| diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestCounter.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestCounter.java | |
| index 1c25ee3..6bc2da1 100644 | |
| --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestCounter.java | |
| +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/util/TestCounter.java | |
| @@ -17,6 +17,7 @@ | |
| */ | |
| package org.apache.hadoop.hbase.util; | |
| import java.util.concurrent.CountDownLatch; | |
| +import java.util.concurrent.atomic.LongAccumulator; | |
This file contains hidden or 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
| import java.io.*; | |
| import java.util.*; | |
| import org.apache.hadoop.conf.*; | |
| import org.apache.hadoop.fs.*; | |
| public class TestReader { | |
| public static void main(String[] args) throws Exception { | |
| final Configuration conf = new Configuration(); | |
| final FileSystem fs = FileSystem.get(conf); |