Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Vikrum vikrum

🎯
Focusing
View GitHub Profile
@vikrum
vikrum / App.scala
Created Jun 26, 2012
Scala REPL exposed via Netty
View App.scala
object App extends Logging {
def main(args: Array[String]) = {
setupNetty
scalaReplConsole
}
/**
* Setup Netty for things like logging, etc. This should happen first. Do not get rid of this.
* You'll have a calamity on your hands if it needs to log under stress and it is unable to.
View openscad
// http://budweiser.cadstudio.cz/2015/08/shadow-cube-3d-model-of-c-d.html
$fn=100;
S=10; // size in mm
// "C" "A" "D" - modelled letters
intersection() {
M("A", S); // "A"
@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"
You can’t perform that action at this time.