Skip to content

Instantly share code, notes, and snippets.

View sshankar's full-sized avatar
💭

Shiv Shankar Menon sshankar

💭
View GitHub Profile

Getting a network trace from a single application

Create a test network namespace

ip netns add test

Create a pair of virtual network interfaces (veth-a and veth-b)

ip link add veth-a type veth peer name veth-b
  jlong cooked_allocated_bytes() {
    jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
    if (UseTLAB) {
      size_t used_bytes = tlab().used_bytes();
      if ((ssize_t)used_bytes > 0) {
        // More-or-less valid tlab.  The load_acquire above should ensure
        // that the result of the add is <= the instantaneous value
        return allocated_bytes + used_bytes;
 }
From fb69a88323eef661b6a9113ad7967138f4d78e9f Mon Sep 17 00:00:00 2001
From: Shiv Shankar <shiv.shankar@gtnexus.com>
Date: Thu, 28 Apr 2016 15:53:33 -0400
Subject: [PATCH] from before it was mainstream
---
GIT-VERSION-GEN | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
# Functions
lf() {
local out=$1
local location=$2
local filetype=$3
local rval=($(find $location -name $filetype -type f))
eval "${out}=($rval)"
}
Gaming Rig Setup on AWS
Network
- Router
- Setup DDNS
- Setup L2TP over IPSec Server
- Firewall: Accept connections only from AWS VPC
- Server
- Setup L2TP client
import os, sys
import ogr
from math import ceil
def main(outputGridfn,xmin,xmax,ymin,ymax,gridHeight,gridWidth):
# convert sys.argv to float
xmin = float(xmin)
xmax = float(xmax)
class InlineTest {
public static int increment(int i){
return i + 1;
}
public static void main(String... args){
int count = 1000_000_000;
int state = 0;
for (int i = 0; i < count; i++){
@sshankar
sshankar / gist:b7a8058966c6df984ed9
Created November 18, 2014 05:20
Building hsdis on OS X (1.8)
wget http://www.java.net/download/openjdk/jdk8/promoted/b132/openjdk-8-src-b132-03_mar_2014.zip
unzip openjdk-8-src-b132-03_mar_2014.zip
cd openjdk/hotspot/src/share/tools/hsdis
wget http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.gz
tar -xzf binutils-2.24.tar.gz
make ARCH=amd64 BINUTILS=binutils-2.24
sudo cp build/macosx-amd64/hsdis-amd64.dylib $(/usr/libexec/java_home)/jre/lib/server/
import java.util.concurrent.atomic.*;
import java.util.*;
public class MovingAvgIntervalEstimator {
final long intervalEndTimes[];
// window properties
final int windowMagnitude;
$ cat <<EOF > __main__.py
heredoc> if __name__ == '__main__':
heredoc> print 'hello, world!'
heredoc> EOF
$ zip hello.zip __main__.py
adding: __main__.py (stored 0%)
$ cat <(echo '#!/usr/bin/env python') hello.zip > hello
$ chmod +x hello