Skip to content

Instantly share code, notes, and snippets.

View djangofan's full-sized avatar

Jon Austen djangofan

View GitHub Profile
@ms-tg
ms-tg / jdk8_optional_monad_laws.java
Created November 11, 2013 21:14
Does JDK8's Optional class satisfy the Monad laws? Yes, it does.
/**
* ```
* Does JDK8's Optional class satisfy the Monad laws?
* =================================================
* 1. Left identity: true
* 2. Right identity: true
* 3. Associativity: true
*
* Yes, it does.
* ```
@isopov
isopov / OioServerTest.java
Created August 2, 2011 17:17
Netty blocking I/O API test
import java.net.InetSocketAddress;
import java.util.concurrent.Executors;
import org.jboss.netty.bootstrap.ClientBootstrap;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
@justincampbell
justincampbell / threaded.bat
Created July 20, 2010 14:21
Threaded batch script
@echo off
set strVariable=[%1]
if %strVariable% NEQ [] goto :Thread
set intTotal=0
echo Start %date% %time%
for /F %%a in ('net view ^| find /i "\\"') do call :Parse %%a
echo Stop %date% %time%
echo Total %intTotal%
goto :eof