Skip to content

Instantly share code, notes, and snippets.

Avatar
💖
Focusing

Tokuhiro Matsuno tokuhirom

💖
Focusing
View GitHub Profile
View ploc
#!/usr/bin/env perl
use strict;
&main; exit;
sub main {
my %white = map { $_ => 1 } qw/
kt java pl js rb py
/;
View gist:0fec6aed02930301a6280ccc5e7a864c
self.addEventListener('message', function(e){
setInterval(function(){
self.postMessage('tick');
}, 1000);
}, false);
View .vimrc
" *************************************************************************
" tokuhirom's .vimrc file.
"
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"
"
" :e ++enc=cp932
"
" *************************************************************************
@tokuhirom
tokuhirom / update_curl.sh
Created Jan 31, 2017 — forked from fideloper/update_curl.sh
Update curl on Ubuntu 14.04
View update_curl.sh
#! /usr/bin/env bash
# Install any build dependencies needed for curl
sudo apt-get build-dep curl
# Get latest (as of Feb 25, 2016) libcurl
mkdir ~/curl
cd ~/curl
wget http://curl.haxx.se/download/curl-7.50.2.tar.bz2
tar -xvjf curl-7.50.2.tar.bz2
@tokuhirom
tokuhirom / README.md
Last active Jan 25, 2017
Bulk generate beta distribution random number generator in XS
View README.md

Calling a XS function many times makes overhead. I recommend to run a for-loop in XS. It makes 155% faster than original implementation. (I want to generate a lot of β dsitribution random numbers)

View bench.p6
use v6;
use Crust::Runner;
my $app = sub ($env) {
return 200, [], ['hello'];
};
my $runner = Crust::Runner.new;
$runner.parse-options(@*ARGS);
@tokuhirom
tokuhirom / RxNettyAccessLogFilter.java
Last active Nov 13, 2016
Recording access logs with RxNetty
View RxNettyAccessLogFilter.java
package com.example.server;
import io.netty.buffer.ByteBuf;
import io.reactivex.netty.protocol.http.server.HttpServerRequest;
import io.reactivex.netty.protocol.http.server.HttpServerResponse;
import io.reactivex.netty.protocol.http.server.RequestHandler;
import rx.Observable;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
View OreLang.java
package com.example;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import com.fasterxml.jackson.databind.ObjectMapper;
public class OreLang {
View code.java
public class JacksonTypeTest {
@Test
public void test() {
}
@JsonSubTypes(
@JsonSubTypes.Type(ImageEntry.class),
@JsonSubTypes.Type(TextEntry.class)
)
View jdk-triple-quote.diff
diff -r 6e14043ceae4 src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java Thu Aug 11 15:47:10 2016 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java Tue Aug 30 06:13:27 2016 +0900
@@ -629,6 +629,39 @@
break loop;
case '\"':
reader.scanChar();
+
+ if (reader.ch == '\"' && reader.bp < reader.buflen) {
+ reader.scanChar();