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
#!/bin/bash | |
# Usage: tracing::init [endpoint; default localhost:4317] | |
function tracing::init() { | |
export OTEL_EXPORTER_OTLP_ENDPOINT="${1:-${OTEL_EXPORTER_OTLP_ENDPOINT:-localhost:4317}}" | |
} | |
# Usage: tracing::auto::init [endpoint; default localhost:4317] | |
function tracing::auto::init() { | |
tracing::init |
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 sun.misc.Unsafe; | |
import java.io.IOException; | |
import java.lang.reflect.Field; | |
import java.nio.ByteBuffer; | |
import java.nio.ByteOrder; | |
import java.nio.channels.FileChannel; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.ArrayList; |
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
#!/bin/bash -e | |
# Stash the staged files if any. | |
NEEDS_UNSTASH=0 | |
if ! git diff --staged --exit-code >/dev/null; then | |
echo -ne '\033[1;32m' | |
echo -n 'Stashing the staged files' | |
echo -e '\033[0m' | |
git stash | |
NEEDS_UNSTASH=1 |
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 sun.misc.Unsafe; | |
import javax.management.ObjectName; | |
import java.io.IOException; | |
import java.lang.management.ManagementFactory; | |
import java.lang.reflect.Field; | |
import java.nio.ByteBuffer; | |
import java.nio.ByteOrder; | |
import java.nio.channels.FileChannel; | |
import java.nio.charset.StandardCharsets; |
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
#include <jvmti.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
JNIEXPORT jint JNICALL | |
Agent_OnAttach(JavaVM* vm, char* options, void* reserved) { | |
if (options != NULL) { | |
int* addr = (int*)strtol(options, NULL, 0); | |
printf("vmoption [%p] = %d\n", addr, *addr); fflush(stdout); |
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
// Replaces implementation of Unsafe.allocateMemory/freeMemory | |
// to avoid long time-to-safepoint pauses. | |
// | |
// Compile: gcc -O3 -fno-omit-frame-pointer -fPIC -shared -olibunmalloc.so unmalloc.c | |
// | |
// Usage: java -agentpath:/path/to/libunmalloc.so ... | |
#include <jvmti.h> | |
#include <stdint.h> | |
#include <stdio.h> |
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 sun.jvm.hotspot.debugger.Address; | |
import sun.jvm.hotspot.runtime.VM; | |
import sun.jvm.hotspot.tools.Tool; | |
import java.io.IOException; | |
import java.io.RandomAccessFile; | |
/** | |
* Changes -XX:MaxJavaStackTraceDepth flag to 1000000 in runtime | |
* without restarting the JVM. |
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
# Source: https://stackoverflow.com/questions/50003378/automatically-set-listenerrule-priority-in-cloudformation-template | |
import random | |
import uuid | |
import traceback | |
import boto3 | |
# Member must have value less than or equal to 50000 | |
ALB_RULE_PRIORITY_RANGE = 1, 50000 |
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
-- for calculation of norm vector -- | |
DELIMITER $$ | |
CREATE FUNCTION vector_norm( vector JSON ) | |
RETURNS DOUBLE | |
READS SQL DATA | |
DETERMINISTIC | |
BEGIN | |
DECLARE array_length INTEGER(11); | |
DECLARE retval DOUBLE(19,2); |
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.IOException; | |
import java.net.Inet4Address; | |
import java.net.InetAddress; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.net.UnknownHostException; | |
import java.util.Arrays; | |
import jpcap.JpcapCaptor; | |
import jpcap.JpcapSender; |
NewerOlder