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
from collections import Counter | |
cnt = Counter() | |
print('start') | |
with open('input.txt') as f: | |
for line in f: | |
splits = line.split(' - ', 1) | |
if len(splits) > 1: | |
cnt[splits[1]] += 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
public class PushWithMultiThreadAndMultiEndpoint { | |
@Value("${cloud.aws.sns.endpoint}") | |
private String SNS_ENDPOINT; | |
@Value("${cloud.aws.credentials.accessKey}") | |
private String ACCESS_KEY; | |
@Value("${cloud.aws.credentials.secretKey}") | |
private String SECRET_KEY; |
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 PushWithOneThread { | |
@Value("${cloud.aws.sns.endpoint}") | |
private String SNS_ENDPOINT; | |
@Value("${cloud.aws.credentials.accessKey}") | |
private String ACCESS_KEY; | |
@Value("${cloud.aws.credentials.secretKey}") | |
private String SECRET_KEY; |
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 PushWithMultiThread { | |
@Value("${cloud.aws.sns.endpoint}") | |
private String SNS_ENDPOINT; | |
@Value("${cloud.aws.credentials.accessKey}") | |
private String ACCESS_KEY; | |
@Value("${cloud.aws.credentials.secretKey}") | |
private String SECRET_KEY; |
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
# installs to /opt/gradle | |
# existing versions are not overwritten/deleted | |
# seamless upgrades/downgrades | |
# $GRADLE_HOME points to latest *installed* (not released) | |
gradle_version=1.11 | |
wget -N http://services.gradle.org/distributions/gradle-${gradle_version}-all.zip | |
sudo unzip -foq gradle-${gradle_version}-all.zip -d /opt/gradle | |
sudo ln -sfn gradle-${gradle_version} /opt/gradle/latest | |
sudo printf "export GRADLE_HOME=/opt/gradle/latest\nexport PATH=\$PATH:\$GRADLE_HOME/bin" > /etc/profile.d/gradle.sh | |
. /etc/profile.d/gradle.sh |
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/bash | |
servers=( 'server1' 'server2' 'server3' 'server4' 'server5' 'server6' ) | |
pems=( 'dev.pem' 'prod.pem' ) | |
#for server in "${servers[@]}" | |
for ((i = 0; i < ${#servers[@]}; i++)) | |
do | |
echo "$i: ${servers[$i]}" | |
done |
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
SELECT | |
count(*) NUM_OF_TABLE, | |
table_schema,concat(round(sum(table_rows)/1000000,2),'M') rows, | |
concat(round(sum(data_length)/(1024*1024*1024),2),'G') DATA, | |
concat(round(sum(index_length)/(1024*1024*1024),2),'G') idx, | |
concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') total_size, | |
round(sum(index_length)/sum(data_length),2) idxfrac | |
FROM information_schema.TABLES | |
GROUP BY table_schema | |
ORDER BY sum(data_length+index_length) DESC LIMIT 10; |
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/bash | |
INDEX=$1 | |
curl -XPUT "localhost:9200/${INDEX}" -d '{ "settings" : { | |
"index" : { | |
"analysis" : { | |
"analyzer" : { | |
"special_character_analyzer" : { | |
"type" : "custom", | |
"filter" : [ "lowercase", "special_character_filter" ], |
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 | |
echo "mount" | |
echo "s3fs [bucketname] [directory] -ouse_cache=/tmp -o allow_other" | |
echo "unmount" | |
echo "fusermount -u [directory]" | |
#echo "pkill -9 -f s3fs" |
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/bash | |
PROGRAM_NAME=$(basename "$0") | |
VERSION_STR="1.0" | |
help_and_exit() { | |
cat <<EOF | |
Usage: $PROGRAM_NAME [OPTION]... HOST PORT... | |
-t TIMEOUT If TIMEOUT seconds reached, consider the port is closed |
NewerOlder