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 | |
echoGreen() { echo $'\e[0;32m'"$1"$'\e[0m'; } | |
echoYellow() { echo $'\e[0;33m'"$1"$'\e[0m'; } | |
abort() { | |
echoYellow "Command 'gradle' not found in your PATH." | |
echoYellow "And could not found 'gradlew' in current directory." | |
echoYellow "Abort." | |
exit 1 |
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
/* | |
* Licensed to the Apache Software Foundation (ASF) under one or more | |
* contributor license agreements. See the NOTICE file distributed with | |
* this work for additional information regarding copyright ownership. | |
* The ASF licenses this file to You under the Apache License, Version 2.0 | |
* (the "License"); you may not use this file except in compliance with | |
* the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
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 java.net.InetSocketAddress; | |
import java.net.URI; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.TimeUnit; | |
import org.java_websocket.WebSocket; | |
import org.java_websocket.WebSocketImpl; | |
import org.java_websocket.client.WebSocketClient; |
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 java.lang.reflect.Method; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Set; | |
import org.springframework.beans.factory.InitializingBean; | |
import org.springframework.boot.autoconfigure.web.WebMvcRegistrationsAdapter; |
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
/** | |
* Simple unique id generator at high concurrency. fork from | |
* <a href="https://github.com/twitter/snowflake/tree/snowflake-2010">snowflake</a>. | |
* <br/> | |
* The return value of {@link IdGenerator#nextId()} is consist of 41-bit timestamp and | |
* 10-bit worker id and 12-bit sequence, so it could support at most 1023 workers to | |
* generate 4095 ids per millisecond. | |
* <br/> | |
* Because the timestamp's bit width is 41, so it could be used for about 69.7 years | |
* {@code ((1<<41) / (365*24*3600*1000))}. The deadline depends on the |
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
#!/bin/sh | |
sort -t ";" -k 2 -u ~/.zsh_history | sort -o ~/.zsh_history |
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 java.io.IOException; | |
import java.net.InetSocketAddress; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.SelectionKey; | |
import java.nio.channels.Selector; | |
import java.nio.channels.ServerSocketChannel; | |
import java.nio.channels.SocketChannel; | |
import java.util.Set; | |
class Server implements Runnable { |
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 java.util.Properties; | |
/** | |
* {@link Properties} which support to refer back to previously defined values (e.g. | |
* from system properties) | |
* | |
*/ | |
class ConfigureProperties extends Properties { | |
private static final long serialVersionUID = -3868173073422671544L; |
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 | |
# Func: mysql database backup | |
# Date: 2016-06-07 | |
USER="user" | |
PSW="psw" | |
DUMP_BIN=`which mysqldump` | |
ADMIN_BIN=`which mysqladmin` | |
MYSQL_BIN=`which mysql` |
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 ByteArrayBuffer { | |
private byte[] buffer; | |
private int len; | |
public ByteArrayBuffer() { | |
this(4096); | |
} | |
public ByteArrayBuffer(int capacity) { | |
if (capacity < 0) { |
NewerOlder