Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
@hongjiang
hongjiang / Public_Recursive_Name_Servers.md
Created May 6, 2021 07:58 — forked from mutin-sa/Top_Public_Recursive_Name_Servers.md
List of Top Public Recursive Name Servers
IPv4 Addr IPv6 Addr ASn Loc Svc Org
8.8.8.8 2001:4860:4860::8888 AS15169 Worldwide (Anycast) Google Public DNS Google
8.8.4.4 2001:4860:4860::8844 AS15169 Worldwide (Anycast) Google Public DNS Google
77.88.8.8 2a02:6b8::feed:0ff AS13238 Worldwide (Anycast) Yandex.DNS Yandex
77.88.8.1 2a02:6b8:0:1::feed:0ff AS13238 Worldwide (Anycast) Yandex.DNS Yandex
1.1.1.1 2606:4700:4700::1111 AS13335 Worldwide (Anycast) Cloudflare-DNS Cloudflare/APNIC
1.0.0.1 2606:4700:4700::1001 AS13335 Worldwide (Anycast) Cloudflare-DNS Clou
@hongjiang
hongjiang / JDIDemo.scala
Created February 18, 2016 14:58 — forked from tyrcho/JDIDemo.scala
JDI in Scala (Java Debug Interface)
// see http://wayne-adams.blogspot.fr/2011/10/generating-minable-event-stream-with.html
import scala.collection.JavaConversions.asScalaBuffer
import scala.collection.JavaConversions.asScalaIterator
import com.sun.jdi.connect.Connector
import com.sun.jdi.event.BreakpointEvent
import com.sun.jdi.request.BreakpointRequest
import com.sun.jdi.request.EventRequest
import com.sun.jdi.Bootstrap
import com.sun.jdi.StringReference
@hongjiang
hongjiang / DirectMemorySize.java
Last active August 28, 2015 13:53 — forked from rednaxelafx/DirectMemorySize.java
An Serviceability-Agent based tool to see stats of NIO direct memory, as an alternative on JDK6 without JMX support for direct memory monitoring. Only works on JDK6; to work on JDK7 will need some tweaking because static variables are moved to Java mirror
import java.io.*;
import java.util.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.tools.*;
import sun.jvm.hotspot.utilities.*;
public class DirectMemorySize extends Tool {
@hongjiang
hongjiang / gist:2fe85e152d942c7f73ab
Created January 23, 2015 17:06
call mac osascript open a new Terminal.app
newTerminal(){
osascript 2>/dev/null <<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end
tell application "Terminal"
activate
do script with command "cd $PWD" in window 1
do script with command "$*" in window 1
end tell
@hongjiang
hongjiang / vpn.sh
Last active October 27, 2015 10:21
mac vpn connection script
#!/bin/bash
PROG_NAME=$0
ACTION=$1
usage() {
echo "Usage: $PROG_NAME {list|ping|optimal|conn|close|status}"
exit 1
}
@hongjiang
hongjiang / msgpack
Last active August 29, 2015 14:07
test_msgpack
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.net.URL;
import org.msgpack.MessagePack;
public class MessagePackReader {
public static void test1() throws Exception {
@hongjiang
hongjiang / busythread.sh
Created September 17, 2014 17:49
检查最耗cpu的java线程,给出cpu的使用率和堆栈信息,只能用于linux系统
#!/bin/bash
if [ $# -eq 0 ];then
echo "please enter java pid"
exit -1
fi
pid=$1
jstack_cmd=""
@hongjiang
hongjiang / cpcheck.sh
Created September 17, 2014 17:46
比较classpath下的所有jar的相似度,以及class冲突的个数
#!/bin/bash
if [ $# -eq 0 ];then
echo "please enter classpath dir"
exit -1
fi
if [ ! -d "$1" ]; then
echo "not a directory"
exit -2