kafka

http://www.jasongj.com/2015/01/02/Kafka%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90/
http://www.jasongj.com/2015/03/10/KafkaColumn1/
http://www.jasongj.com/2015/04/24/KafkaColumn2/
http://www.jasongj.com/2015/06/08/KafkaColumn3/
http://www.jasongj.com/2015/08/09/KafkaColumn4/
http://www.jasongj.com/2015/12/31/KafkaColumn5_kafka_benchmark/

http://lxw1234.com/archives/2015/11/571.htm
http://my.oschina.net/itblog/blog/540918

http://blog.cloudera.com/blog/2014/09/apache-kafka-for-beginners/
http://www.benniehaelen.com/hadoop/using-apache-kafka/
https://dzone.com/articles/kafka-clients-at-most-once-at-least-once-exactly-o
https://medium.com/@ajmalbabu/kafka-0-9-0-clients-db1f43257d30#.kimer9o9m

pppoe on ubuntu

ubuntu16.04 amd64
(ok under i7pc, fail under i7tp

1
2
3
4
5
6
7
8
9
10
11
12
sudo -s
apt-get install pppoeconf traceroute curl wget
pppoeconf # xxxxxxxx@hient.net aaaaaaaa (fixed ip in hinet: xxxxxxxx@ip.hinet.net
poff # poff -a (if encounter any error
pon dsl-provider
plog
ifconfig
#traceroute ptt.cc
#nano /etc/network/interfaces
route add default dev ppp0 # set as default routing.
curl ipinfo.io # confirm the default routing works
ifconfig ppp0 && poff && pon dsl-provider && ifconfig ppp0 # force renewing pppoe ip

docker trial

preparation

★ubuntu i386版本無法裝docker,一定要amd64版本才能裝docker。

sudo -s
apt-get install htop iftop iotop unzip p7zip p7zip-full rar unrar openssh-server openssh-client
service sshd status
reboot

★under ubuntu16.04 amd64
sudo -s
uname -a
cat /etc/lsb-release
apt-get update
apt-get upgrade

install docker

curl -sSL https://get.docker.com/ | sudo sh
service docker status
docker version
docker info

test docker works

docker run hello-world

search and pull

docker search ubuntu
docker pull ubuntu
docker pull java
docker pull tomcat
docker pull mysql
docker pull jplock/zookeeper:3.4.6
docker pull ches/kafka
docker pull sequenceiq/spark:1.6.0
docker pull dylanmei/zeppelin

basic

docker pull ubuntu
docker create ubuntu:16.04
docker run -i -t ubuntu:16.04 /bin/bash
df -h
docker run -i -t -d ubuntu:16.04 /bash/sh -c “while true;do echo hello world;sleep 1; done” # -d run in background
docker ps #show containers
docker logs {container_id}
docker exec -i -t {container_id} /bin/bash
docker stop {container_id}
docker start {container_id}
docker rm {container_id}
docker rm {container_id} -f

pull, create, show, remove image

docker pull ubuntu
docker create ubuntu:16.04
docker images #show all images
docker rmi {image_name} #delete specific image

references

https://docs.docker.com/engine/installation/linux/ubuntulinux/
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
https://www.howtoforge.com/tutorial/docker-installation-and-usage-on-ubuntu-16.04/
https://philipzheng.gitbooks.io/docker_practice/content/install/ubuntu.html #quiet old 2014

常用 official images

rabbitmq
memcached
radis
cassandra
nginx
httpd
haproxy
jenkins
kibana
elasticsearch
logstash
postgres
mariadb
java
tomcat
mysql
ubuntu
debian
centos
solr
maven
jetty

cAdvisor

1
2
3
4
5
6
7
8
9
docker run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--publish=8080:8080 \
--detach=true \
--name=cadvisor \
google/cadvisor:latest

http://{container_ip}:8080

install docker-machine

@see https://github.com/docker/machine/releases
@see https://docs.docker.com/machine/install-machine/ https://docs.docker.com/machine/get-started/
@see https://www.digitalocean.com/community/tutorials/how-to-provision-and-manage-remote-docker-hosts-with-docker-machine-on-ubuntu-16-04

1
2
3
4
5
6
7
8
9
root@ubuntu:~# date
Fri Aug 26 02:53:41 PDT 2016
root@ubuntu:~# curl -L https://github.com/docker/machine/releases/download/v0.8.1/docker-machine-`uname -s`-`uname -m` > /usr/local/bin/docker-machine && chmod +x /usr/local/bin/docker-machine
root@ubuntu:~# docker-machine --version
docker-machine version 0.8.1, build 41b3b25
root@ubuntu:~# docker-compose --version
docker-compose version 1.5.2, build unknown
root@ubuntu:~# docker --version
Docker version 1.12.1, build 23cf638

cheatscript

redis

docker run —name gitlab-redis -d \
—volume /srv/docker/gitlab/redis:/var/lib/redis \
sameersbn/redis:latest

postgresql 9.6

docker run —name gitlab-postgresql -d \
—env ‘DB_NAME=gitlabhq_production’ \
—env ‘DB_USER=gitlab’ —env ‘DB_PASS=password’ \
—env ‘DB_EXTENSION=pg_trgm’ \
—volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \
sameersbn/postgresql:9.6

msql

docker run —name mysql -d \
-p 33306:3306 \
-e MYSQL_ROOT_PASSWORD=password \
-v /srv/docker/mysql/conf:/etc/mysql/conf.d \
-v /srv/docker/mysql/data:/var/lib/mysql \
mysql:5.7

docker run —name mysql -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password mysql:5.7.10
docker exec mysql cat /etc/mysql/my.cnf

spark 1.6

docker run -i -t -h sandbox sequenceiq/spark:1.6.0 bash

zookeeper

kafka

ubuntu change locale

1
2
3
4
locale
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8"
sudo vi /etc/default/locale

# File generated by update-locale
LANG=en_US.UTF-8
#LC_NUMERIC=”lzh_TW”
#LC_TIME=”lzh_TW”
#LC_MONETARY=”lzh_TW”
#LC_PAPER=”lzh_TW”
#LC_NAME=”lzh_TW”
#LC_ADDRESS=”lzh_TW”
#LC_TELEPHONE=”lzh_TW”
#LC_MEASUREMENT=”lzh_TW”
#LC_IDENTIFICATION=”lzh_TW”
LANGUAGE=en_US.UTF-8

改回繁體中文 zh_TW

1
2
3
4
sudo locale-gen zh_TW 
sudo locale-gen zh_TW.UTF-8
sudo dpkg-reconfigure locales
sudo update-locale LANG="zh_TW.UTF-8" LANGUAGE="zh_TW"

改完重新登入後才有效果

ubuntu16 boot into text mode

網路上找的不管用-1

sudo vi /etc/default/grub

  1. #GRUB_CMDLINE_LINUX_DEFAULT=”quite splash”
  2. GRUB_CMDLINE_LINUX=”text”
  3. GRUB_TERMINAL=console
    sudo update-grub
    sudo reboot

for system-enabled desktop only
sudo systemctl set-default multi-user.target
sudo systemctl set-default graphical.target

網路上找的不管用-2

sudo apt-get install rcconf
>uncheck x11-common

disable xwindow 可能不是正確的做法。但是管用

sudo service lightdm stop
sudo systemctl disable lightdm
sudo reboot

關掉螢幕保護

setterm -blank 0 -powerdown 0 -powersave off
xset s off
xset -dpms

basic-english

Globish 全球化英文 - IBM老總教你1500字溜英文

詭弔的是若你如書中所說的花費時間精力,已經是可以學習標準英文的程度。
不過書中不斷強調/強化英語是工具、溝通重於正統的概念是不錯的。

http://www.basic-english.org/
850單字 (600名詞 150形容詞 100動詞)

a able about above accept account accuse achieve across act add admit adult advertisement advise affect afraid after again against age agency ago agree ahead aid aim air alive all allow ally almost alone along already also although always among amount and angle angry announce another answer any apologize appeal appear apple appoint approve area argue arm army around arrest arrive art as ask assist at attach attack attempt attend attention authority automatic autumn available average avoid awake award away baby back bad bag balance ball ballot ban bank bar barrier base basket battle be bear beat beauty because become bed beer before begin behind believe bell belong below bend best betray better between big bill bird birth bit bite black blade blame blank blanket bleed blind block blood blow blue board boat body bomb bone bonus book boot border born borrow boss both bottle bottom box boycott brain brake branch brave bread break breathe brick bridge brief bright bring broad broadcast brother brown brush budget build bullet burn burst bury business busy but butter button buy by cabinet call calm camera camp campaign can cancel capture car card care carriage carry case cash cat catch cause celebrate cell center century ceremony certain chain chair chairman challenge champion chance change channel character charge chart chase cheap check cheer cheese chemical chest chief child choose church circle citizen city civilian claim clash class clean clear climate climb clock close cloth cloud coal coast coat code cold colect college colony color combine come comfort command comment committee common communicate community company compare compete complete compromise computer concern condemn conference confirm congratulate congress connect consider contain continue control cook cool cooperate copy cork corn corner correct cost cotton count country course court cover cow crash create credit crew crime criminal crisis criticize crop cross crowd crush cry culture cup cure current custom cut damage dance danger dark date daughter day dead deaf deal dear debate debt decide declare decrease deep defeat defend define degree delay deliver demand demonstrate denounce deny departure depend deploy depression describe desert design desire destroy detail develop device die diet differ difficult dig dinner diplomat direct dirt disappear disarm discover discuss disease disk dismiss dispute distance divide do doctor document dog door doubt down drain draw dream dress drink drive drop drug dry during dust duty each ear early earn earth east easy eat edge education effect effort egg either elastic electricity element else embassy emergency emotion employ empty end enemy enforce engine enjoy enough enter entertain environment equal equate equipment erase escape especially establish estimate ethnic evaporate even event ever every evidence evil exact example except exchange excuse execute exercise exist exit expand expect expense experience experiment expert explain explode explore export express extend extra extreme eye face fact factory fail fair fall false family famous far fast fat father fear feather feed feel female fertile few field fierce fight figure file fill film final finance find fine finger finish fire firm first fish fist fit fix flag flat float floor flow flower fluid fly fog fold follow food fool foot for forbid force foreign forest forget forgive form former forward frame free freeze fresh friend frighten from front fruit fuel full fun future gain gallon game gang garden gas gather general gentle get gift girl give glass global go goal god gold good govern grammar grass great green gray ground group grow guarantee guard guess guide guilty gun guy hair half galt hand hang happen happy hard hat hate have he head heal health hear heart heat heavy help her here hers hide high hijack hill him hire his history hit hold hole holiday hollow holy home honest hope horrible horse hospital hostage hostile hot hour house how however huge human humor hunger hunt hurry hurt husband ice idea identify if ill imagine import important improve in inch incident include increase independent indicate individual industry infect influence inform inject injure innocent insane insect inspect innstead instrument insult insureance intelligence intense interest interfere international into invade invent invest investigate invite involve iron island issue it item its jacket jail jewel job join joint joke joy judge jump jury just keep key kick kid kill kind king kiss kit kitchen knife know labor lack lake land language large last late laugh law lay lead leak learn least leave left leg legal lend length less let latter level lie life lift light like limit line link lip liquid list listen little live load loan local locate lock log lone long look loose lose lot loud love low luck mail main major make male man manufacture many map march mark market marry master match material matter may mayor me meal mean measure meat media medicine meet member memory mental mercy message metal method middle might mile military milk mind mine minister minor miscellaneous miss mistake mix mob model moderate modern money month moon moral more morning most motion mother mountain mouth move movie much murder muscle music must my mystery name narrow nation native navy near necessary neck need neighber neither nerve neural never new news next nice night no noise noon normal norh nose not note nothing notice now nothere number obey object ovserve occupy occur of off offensive offer office officer often oil old on once only open operate opinion opportunity opposite oppress or order organize other ounce our ours oust out over owe own page pain paint pan pants paper parade parcel parent parliament part party pass passenger past paste path patient pattern pay peace pen pencil people percent perfect perform perhaps period permanent permit person physical pick picture piece pig pilot pint pipe place plain plan plane plant plastic plate play please plenty pocket point poison policy politics pollute poor popular port position possess possible postpone pound pour powder power practice praise pray pregnant present press pressure pretty prevent price print prison private prize probable problem process professor profit program progress project property propose protect protest prove provide public publish pull punish purchase pure purpose push put quality quart quarter queen question quick quiet quit quite race radiation raid rail rain raise range rare rate rather ray reach react read ready real reason receive recongnize record recover red reduce refugee refuse regret regular reject relation release remain remember remove repair repeat report represent request require rescue research resign resist resolution resource respect responsible rest restrain result retire return revolt reward rice rich ride right ring riot rise risk river road rob rock rocket roll roof room root rope rough round row rob robber ruin rule run sad safe sail salt same sand satisfy save say scale scare school science script sea search season seat second secret section security see seed seek seem seize seldom self sell senate send sense sentence separate series serious serve set settle several severe sex shade shake shall shame shape share sharp she sheet shelf shell shelter shine ship shirt shock shoe shoot shop short should shout show shrink shut sick side sign signal silence silk silver similar simple since sing single sister sit situation size skill skin skirt sky slave sleep slide slip slow small smart smash smell smile smoke smooth snack snake sneeze snow so soap social society soft soil soldier solid solve some son song soon sorry sort soul sound south space speak special speech speed spell spend spirit spot spread spring spy square stairs stamp stand star start starve state station status stay steal steam steel step stick still stomach ston stop store storm story straight strange stream street stretch strike string strong structure struggle student study stupid subject substance substitute succeed such sudden suffer sugar suggest suit summer sun supervise supply support suppose suppress sure surface surprise surround survive suspect suspend swallow swear sweet swim symbol sympathy system table tail take talk tall target task taste tax tea teach team tear technology tell term terrible territory terror test than thank that the theater their theirs them then theory there ehese they thick thin thing think third this those though thought threaten through throw thus tie tight time tin tiny tired title to today together tomorrow one tongue tonight too tool tooth top total touch toward town track trade tradition traffic train transport travel treason treasure treat treaty tree trial tribe trick trip troop trouble truck true trust try tube turn twice trire under understand unit universe university unless until up upon urge urgent us use usual valley value vary vegetable vehicle version very veto vicious victim victory view village violate violence visit voice vote wage wait walk wall want war warm warn wash waste watch water wave way we weak wealth weapon wear weather week weight welcome well west wet what wheat wheel when where whether which while white who whole why wide wife wild will win wind window wine window wine wing winter wire wise wish with withdraw without woman wonder wood wool word work world worry worse worth wound wreck write wrong yard yawn year yellow yes yesterday yet you young your yours

101 verb
drive ride write break choose forget freeze speak steal begin drink run shrink sing spring swim mistake shake take blow fly frow know throw withdraw swear tear wear show be beat become bite com do eat fall forbid forgive give go hide lie see bleed feed lead meet read shoot sleep speed hear dig hang stick strike awake get shine win bend build lend lose send spend deal mean bring buy catch fight seek teach think find pay say stand understand feel hold keep leave sell tell have light make sit slide burst cost cut hit hurt put set shut spread

這世界上有兩種得到。一種是花錢買到,另一種是要集中注意力動手學到。

java8 lambda

list.stream().forEach(out::println)
filter(Predicate)
mapToInt(Employee::getAge)
map(Player::getName)
sum()
max()
average()
count
getAsInt()
getAsDouble()
findFirst()
reduce(0,lambda)
reduce(lambda)
reduce((total,value)->total+value)
collect(toList())
collect(arrayList::new,ArrayList::add,ArrayList::addAll)
flapMap

steam() —————> parallelStream()
collect(groupingBy(Person::getGender))
collect(groupingByConcurrent(Person::getGender))
forEach(out::println)
forEachOrdered(out::println)