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 / 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 / oneliners.txt
Last active Mar 3, 2017
Various One Liners
View oneliners.txt
# On bash + Linux
# Show TCP sockstats every 5 seconds
$ while [ : ]; do echo -n `date`; echo -n ": "; cat /proc/net/sockstat | sed 'N;s/\n/ /;' | grep TCP; sleep 5; done
# Show netstat connection state counts every 5 seconds
$ while [ : ]; do echo -n `date`; echo -n ": "; netstat -n | awk '/^tcp/ {t[$NF]++}END{for(state in t){print state, t[state]} }' | tr '\n' ' '; echo ; sleep 5; done
# Show top 25 established IPs and their counts
$ lsof -n|grep TCP|grep ESTABLISHED|awk '{print $9}' |grep -e "->"|awk -F '->' '{print $2}'|awk -F ':' '{print $1}'|sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n|uniq -c|sort -rn|head -25
@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">
@vikrum
vikrum / .osx
Last active Jun 13, 2019
Vikrum's Most Excellent Antiques, Curiosities, and Dotfiles
View .osx
defaults write com.apple.Safari IncludeDebugMenu 1
defaults write com.apple.dock no-bouncing -bool TRUE
defaults write com.apple.notificationcenterui bannerTime 1
defaults write -g ApplePressAndHoldEnabled -bool false
You can’t perform that action at this time.