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 me.lotabout; | |
import com.sun.tools.attach.AgentInitializationException; | |
import com.sun.tools.attach.AgentLoadException; | |
import com.sun.tools.attach.AttachNotSupportedException; | |
import com.sun.tools.attach.VirtualMachine; | |
import java.io.IOException; | |
import java.lang.instrument.ClassFileTransformer; | |
import java.lang.instrument.Instrumentation; | |
import java.lang.instrument.UnmodifiableClassException; |
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 python3 | |
import struct | |
import socket | |
import time | |
# Need to run with root permission cause RAW socket is used | |
# ref: | |
# - https://dnaeon.github.io/traceroute-in-python/ |
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 python3 | |
import os | |
import struct | |
import socket | |
import time | |
def checksum(bytestr): | |
# ref | |
# - https://en.wikipedia.org/wiki/IPv4_header_checksum |
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
// ==UserScript== | |
// @name Prophet Links | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2 | |
// @description try to take over the world! | |
// @author You | |
// @match http://172.27.128.87:40121/* | |
// @grant none | |
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js |
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 me.lotabout; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.Future; | |
import java.util.concurrent.TimeUnit; | |
import org.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.annotations.BenchmarkMode; |
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
import org.apache.catalina.connector.Connector; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.boot.builder.SpringApplicationBuilder; | |
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; | |
import org.springframework.boot.web.servlet.server.ServletWebServerFactory; | |
import org.springframework.context.annotation.Bean; | |
@SpringBootApplication | |
public class SpringApplication { |
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 me.lotabout; | |
import com.fasterxml.uuid.Generators; | |
import com.fasterxml.uuid.impl.RandomBasedGenerator; | |
import com.fasterxml.uuid.impl.TimeBasedGenerator; | |
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; | |
import java.util.Random; | |
import java.util.UUID; |
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
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.CyclicBarrier; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import java.util.concurrent.locks.Lock; | |
import java.util.concurrent.locks.ReentrantLock; | |
public class SyncTest { | |
private enum TestType { | |
SYNCHRONIZED, VOLATILE, ATOMIC, LOCK, FAIR_LOCK |
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
import sun.misc.Unsafe; | |
import java.lang.reflect.Field; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import java.util.concurrent.atomic.LongAdder; | |
public class ConcurrencyTest { | |
private enum TestType { |
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 python3 | |
# -*- coding: utf-8 -*- | |
from datetime import datetime | |
import fileinput | |
for line in fileinput.input(): | |
print(f'[{datetime.now()}] {line}', end='') |
NewerOlder