Skip to content

Instantly share code, notes, and snippets.

View ayanamist's full-sized avatar

ayanamist ayanamist

View GitHub Profile
@rednaxelafx
rednaxelafx / DirectMemorySize.java
Created January 11, 2012 07:18
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 {
@daqing
daqing / first-echo-server.c
Created September 18, 2011 06:29
my first forking echo server
#include <stdio.h>
#include <stdlib.h> // for exit
#include <sys/socket.h> // for socket
#include <sys/types.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <errno.h>
#include <sys/wait.h>
@yannk
yannk / gist:101201
Created April 24, 2009 16:40
svn-diff.pl <branch> generate diffs that Review Board can understand
#!/usr/bin/perl
use strict;
use warnings;
my $branch = shift;
my $head = `git rev-list --date-order --max-count=1 $branch`;
my $svnrev = `git svn find-rev $head`;
my $diff = `git diff --find-copies-harder --no-prefix $branch...`;
my $space = " ";
chomp $svnrev;