This file contains hidden or 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 static PublicKey getKey() { | |
| try { | |
| Security.addProvider(new BouncyCastleProvider()); | |
| CertificateFactory cf = CertificateFactory.getInstance("X509", "BC"); | |
| InputStream is = new FileInputStream("test.pem"); | |
| X509Certificate certificate = (X509Certificate) cf.generateCertificate(is); | |
| is.close(); | |
| return certificate.getPublicKey(); |
This file contains hidden or 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 Test { | |
| public static void main(String... args) { | |
| final BlockingQueue<String> queue = new LinkedBlockingQueue<String>(); | |
| Thread running = new Thread(new Runnable() { | |
| @Override | |
| public void run() { | |
| while (true) { | |
| try { | |
| String data = queue.take(); |
This file contains hidden or 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
| package my.domain.utils; | |
| import java.io.Serializable; | |
| import java.sql.Array; | |
| import java.sql.Connection; | |
| import java.sql.PreparedStatement; | |
| import java.sql.ResultSet; | |
| import java.sql.SQLException; | |
| import java.sql.Types; |
This file contains hidden or 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
| :w !sudo tee % |
This file contains hidden or 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
| server { | |
| listen 80; | |
| return 301 https://$host$request_uri; | |
| } | |
| upstream wildfly { | |
| server 127.0.0.1:8080; | |
| } | |
| server { |
This file contains hidden or 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
| ##Build docker | |
| sudo docker build -t image-name . | |
| sudo docker build -t image-name . --add-host domain:ip | |
| ##Run docker with interactive mode and allocate a pseudo-TTY | |
| docker run -i -t image-name | |
| docker run -i -t --add-host domain:ip image-name | |
| ##Start and attach a container | |
| docker start container-name |
This file contains hidden or 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
| rabbitmqctl add_user test test | |
| rabbitmqctl set_user_tags test administrator | |
| rabbitmqctl set_permissions -p / test ".*" ".*" ".*" |
This file contains hidden or 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
| curl -OL http://ftp.yzu.edu.tw/gnu/libtool/libtool-2.4.6.tar.xz | |
| tar -xzf libtool-2.4.6.tar.xz | |
| cd libtool-2.4.6 | |
| ./configure && make && sudo make install |
This file contains hidden or 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
| l = [1,1,1,1,1,1,2,2,2,2,2,3,4,4,4,4,4,4,5,5,5] | |
| l=list(set(l)) |
This file contains hidden or 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
| -module(mod_admin_cluster). | |
| -author('highlyunavailable@gmail.com'). | |
| -behaviour(gen_mod). | |
| -export([ | |
| join_cluster_as_master/1, | |
| join_cluster/1, | |
| leave_cluster/0, | |
| leave_cluster/1, |