This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
### | |
# In order to free up some space by removing unused languages from Semaphore environment | |
# Add the line below to your setup command in Project Settings | |
# | |
# wget https://gist.githubusercontent.com/mimimalizam/e3fd7084f88384f4b2dfca035e3da2d4/raw/remove_unused_languages.sh && bash remove_unused_languages.sh | |
# | |
# These commands will: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,5c1,4 | |
< total 520 | |
< drwxr-xr-x 67 jamie staff 2278 25 Apr 21:11 . | |
< drwxr-xr-x 18 jamie staff 612 25 Apr 14:32 .. | |
< -rw-r--r-- 1 jamie staff 85 3 Mar 13:19 00-namespace.yaml | |
< -rw-r--r-- 1 jamie staff 586 25 Apr 16:36 03-auth.yaml | |
--- | |
> total 392 | |
> drwxr-xr-x 52 jamie staff 1768 25 Apr 21:11 . | |
> drwxr-xr-x 14 jamie staff 476 24 Apr 09:05 .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am jamieap on github. | |
* I am jamieap (https://keybase.io/jamieap) on keybase. | |
* I have a public key ASAW47piBSQQjH-O0cEm7b5_8VGAVaK_rxq5PbPGvIPhKwo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.base.Throwables; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
public class Main { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ServerBootstrap b = new ServerBootstrap(); | |
b.group(acceptorGroup, handlerGroup) | |
.channel(NioServerSocketChannel.class) | |
.childHandler(new MySocketInitialiser()) | |
.option(ChannelOption.SO_BACKLOG, 5) | |
.childOption(ChannelOption.SO_KEEPALIVE, true); | |
b.localAddress(port).bind().sync(); | |
LOG.info("Started on port {}", port); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Your name is Jamie Perkins! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# jamie at eduD692.kent.ac.uk in ~ [12:08:52] | |
$ telnet localhost 9000 | |
Trying ::1... | |
Connected to localhost. | |
Escape character is '^]'. | |
{"firstName":"Jamie", "lastName":"Perkins"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INFO [2016-02-16 12:06:38,880] nettytest.SocketServer: Started on port 9000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JsonDecoder<T> extends MessageToMessageDecoder<String, T> { | |
private static final Gson GSON = new GsonBuilder().create(); | |
private final Class<T> clazz; | |
public JsonDecoder(Class<T> clazz, Class<?>... acceptedMsgTypes) { | |
super(acceptedMsgTypes); | |
this.clazz = checkNotNull(clazz); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Performs the initial set up of sockets as they connect to Netty. | |
* Registers the pipeline of handlers that received messages are passed through | |
*/ | |
public class MySocketInitialiser extends ChannelInitializer<SocketChannel> { | |
@Override | |
public void initChannel(SocketChannel ch) throws Exception { | |
ChannelPipeline pipeline = ch.pipeline(); |
NewerOlder