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
@Test | |
public void autoBoxing() { | |
Long v = 555L; | |
v = v + 2; | |
v = v + 3; | |
System.out.println(v); | |
} | |
@Test | |
public void autoBoxing2() { |
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
class HashBasedMutexProvider { | |
private static final int DEFAULT_DISPERSION = 1000; | |
private List<Object> mutexes = new ArrayList<Object>(); | |
private int dispersion; | |
HashBasedMutexProvider() { | |
this(DEFAULT_DISPERSION); | |
} | |
HashBasedMutexProvider(int dispersion) { |
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 String a() { | |
String msg = "aaa"; | |
return msg; | |
} | |
public String b() { | |
String msg = new String("aaa"); | |
return msg; | |
} |
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 SMTPTest { | |
private final String from = "[email protected]"; | |
@Test | |
public void shouldSendMail() throws MessagingException { | |
mailTo("[email protected]"); | |
} | |
private void mailTo(String to) throws MessagingException { | |
Properties props = new Properties(); |
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
#!/bin/bash | |
ip="`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`" | |
for ((i=0; i<$1; i++)); do | |
hport=$(expr 21000 + $i) | |
tport=$(expr 22000 + $i) | |
name=$ip+$i | |
../bin/elasticsearch -Des.cluster.name=music-es-dev -Des.multicast.enabled=true -Des.http.port=$hport -Des.transport.tcp.port=$tport -Des.index.number_of_shards=10 -Des.index.number_of_replicas=4 -Des.node.name=$name | |
done |
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
#!/bin/bash | |
es="elasticsearch-0.90.11" | |
ip="`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`" | |
http_port=21000 | |
trans_port=21001 | |
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/$es.tar.gz | |
gzip -d $es.tar.gz | |
tar -xvf $es.tar | |
mv ./$es/config/elasticsearch.yml ./$es/config/elasticsearch.yml.old |
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
alias clear-cache='sync && echo 3 | sudo tee /proc/sys/vm/drop_caches' |
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
# For more information on configuration, see: | |
# * Official English Documentation: http://nginx.org/en/docs/ | |
# * Official Russian Documentation: http://nginx.org/ru/docs/ | |
user www; | |
worker_processes 2; | |
error_log /home/www/logs/nginx/error.log; | |
#error_log /var/log/nginx/error.log notice; | |
#error_log /var/log/nginx/error.log info; |
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
#!/usr/bin/perl | |
use DBI; | |
use Time::HiRes qw(time); | |
use List::Util qw(shuffle); | |
my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost;rewriteBatchedStatements=true", "root", "", {'RaiseError' => 1}); | |
#insert_seq(5000000, 'nulltest'); | |
#insert_seq(300000, 'seqtest'); |
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
Connection conn = null; | |
Statement stmt = null; | |
ResultSet rs = null; | |
try { | |
conn = template.getDataSource().getConnection(); | |
stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); | |
stmt.setFetchSize(Integer.MIN_VALUE); | |
rs = stmt.executeQuery("SELECT * FROM push"); | |
while (rs.next()) { |