Skip to content

Instantly share code, notes, and snippets.

View joohee's full-sized avatar

Joohee Kang joohee

  • Korea
View GitHub Profile
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
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;
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;
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;
@joohee
joohee / install-gradle-centos.sh
Created March 3, 2015 06:49
install-gradle-centos.sh
# 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
@joohee
joohee / connect.sh
Created January 28, 2015 01:42
connect.sh
#!/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
@joohee
joohee / data_size.sql
Created October 30, 2014 02:36
data size sql
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;
@joohee
joohee / elasticsearch_settings_mapping.sh
Last active August 29, 2015 14:08
elasticsearch settings mapping
#!/bin/bash
INDEX=$1
curl -XPUT "localhost:9200/${INDEX}" -d '{ "settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"special_character_analyzer" : {
"type" : "custom",
"filter" : [ "lowercase", "special_character_filter" ],
@joohee
joohee / s3fs.sh
Created October 20, 2014 00:55
s3fs mount/umount
#!/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"
@joohee
joohee / portscan.sh
Created August 15, 2014 08:36
[bash] portscan.sh
#!/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