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
@Configuration | |
public class ExecuteServiceConfiguration { | |
@Bean | |
public ExecutorService executorService() { | |
return new ThreadPoolExecutor( | |
20, | |
50, | |
60, TimeUnit.SECONDS, | |
new ArrayBlockingQueue<>(2000), r -> { | |
Thread thread = new Thread(r); |
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.NetworkInterface; | |
import java.security.SecureRandom; | |
import java.time.Instant; | |
import java.util.Enumeration; | |
/** | |
* Distributed Sequence Generator. | |
* Inspired by Twitter snowflake: https://github.com/twitter/snowflake/tree/snowflake-2010 | |
* |
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
version: '3' | |
services: | |
zookeeper: | |
image: zookeeper | |
ports: | |
- 2181:2181 | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
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
# replace old_string with new_string in the path recursively | |
sed -i '' 's/old_string/new_string/g' $( find /path -name file_name ) |
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
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java8-installer |
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
ruby -run -e httpd . -p 5000 |
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
# Required for windows: | |
# Download wget utlity for windows | |
require 'nokogiri' | |
require 'open-uri' | |
# Get a Nokogiri::HTML::Document for the page we’re interested in... | |
doc = Nokogiri::HTML(open('http://download.orfjackal.net/lets-code/')) |
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
URLClassLoader classLoader = null; | |
try { | |
// create url class loader to load the servlet class | |
URL[] urls = new URL[1]; | |
URLStreamHandler urlStreamHandler = null; | |
File classPath = new File(Constents.WEB_ROOT); | |
String repository = (new URL("file", null, classPath.getCanonicalPath() + File.separator)).toString(); |
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
# update & upgrade ubuntu | |
sudo apt-get update | |
sudo apt-get upgrade | |
# install fcixt fcitx-googlepinyin | |
sudo add-apt-repository ppa:fcitx-team/nightly -y | |
sudo apt-get update | |
sudo apt-get install fcitx fcitx-googlepinyin | |
# cinnamon |