Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

vikrum

🎯
Focusing
Block or report user

Report or block vikrum

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vikrum
vikrum / 95th.py
Created Dec 31, 2013
Get 95th percentile from stdin
View 95th.py
#!/usr/bin/env python
#
# based on http://stackoverflow.com/a/2753343o
#
# input needs to be presorted
#
import math
import functools
import fileinput
@vikrum
vikrum / pacific-zulu.txt
Created Mar 28, 2013
Super lazy mode lookup table for Pacific to Zulu time.
View pacific-zulu.txt
PST PDT GMT
01:00 02:00 09:00
02:00 03:00 10:00
03:00 04:00 11:00
04:00 05:00 12:00
05:00 06:00 13:00
06:00 07:00 14:00
07:00 08:00 15:00
08:00 09:00 16:00
09:00 10:00 17:00
@vikrum
vikrum / probe.sh
Last active Dec 13, 2015
Probe SSL server for supported ciphers. (Modified from: http://superuser.com/a/224263/199361 )
View probe.sh
#!/usr/bin/env bash
# OpenSSL requires the port number.
SERVER=$1:443
DELAY=1
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
echo Obtaining cipher list from $(openssl version).
for cipher in ${ciphers[@]}
@vikrum
vikrum / Png2Json.java
Created Feb 11, 2013
Quick hack to dump an image to JSON.
View Png2Json.java
package com.firebase.sandbox;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import org.json.JSONObject;
public class Png2Json {
public static void main(String[] args) {
@vikrum
vikrum / sak.sh
Created Feb 4, 2013
Oh, don't mind me, I'm just running roughshod over your processes.
View sak.sh
#!/bin/bash
#
# seek and kill a mem hog fork()'d child
#
SEEK="stud"
SNOOZE="6000"
while [ : ]; do
echo Snoozing for $SNOOZE
@vikrum
vikrum / bandwidth.pl
Last active Dec 11, 2015
display linux interface bandwidths on a regular interval (http://arctic.org/~dean/scripts/bandwidth) Modified to: 1) include aggregates; 2) average packet sizes; and, 3) scaled totals.
View bandwidth.pl
#!/usr/bin/perl -w
# display linux interface bandwidths on a regular interval
# dep: yum -y install perl-Time-HiRes
# Copyright (c) 2005 Dean Gaudet <dean@arctic.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@vikrum
vikrum / gist:4005258
Created Nov 3, 2012
Various distributions of the alphabet
View gist:4005258
var naturalDist = "abcdefghiklmnopqrstuvwxyz";
var scrabbleDist = "aaaaaaaaabbccddddeeeeeeeeeeeeffggghhiiiiiiiiijkllllmmnnnnnnooooooooppqrrrrrrssssttttttuuuuvvwwxyyz";
var englishDist = "aaaaaaaabbcccddddeeeeeeeeeeeefffgghhhhhhiiiiiiijkllllmmnnnnnnnooooooooppqrrrrrrssssssstttttttttuuuvwwwxyyz";
@vikrum
vikrum / twitter-jvm.sh
Created Jul 2, 2012
Twitter's JVM startup template
View twitter-jvm.sh
# Courtesy @marius, April 2012
#
# "Our most common type of system are mostly stateless, high volume,
# low latency RPC systems. For these, we generally use this template:"
HEAP_OPTS="-Xmx17G -Xms17G -XX:NewSize=15G -XX:+UseNUMA"
GC_OPTS="-XX:+UseConcMarkSweepGC -XX:SurvivorRatio=40 -XX:+CMSScavengeBeforeRemark"
GC_LOG_OPTS="-verbosegc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC"
GC_LOG="-Xloggc:/var/log/$APP_NAME/gc.log"
DEBUG_OPTS="-XX:ErrorFile=/var/log/$APP_NAME/java_error%p.log"
@vikrum
vikrum / LockOnLocksOnLocks.java
Created May 2, 2012
Locks On Locks On Locks
View LockOnLocksOnLocks.java
package sandbox;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import org.apache.commons.lang3.time.StopWatch;
public class LockOnLocksOnLocks {
@vikrum
vikrum / websocketplayground.html
Created Oct 12, 2011
Quick, dirty, in-browser websocket playground
View websocketplayground.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>websocket playground</title>
<meta charset="utf-8">
<meta name="description" content="Quick, dirty, and in-browser websocket playground">
<meta name="author" content="@vikrum5000">
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<style type="text/css">
You can’t perform that action at this time.