EExcel 丞燕快速查詢2

EExcel 丞燕快速查詢2
EExcel 丞燕快速查詢2 https://sandk.ffbizs.com/

[Failed again!!] kibana geo_point How to

Fxxx kibana elk  Now try to do again. But can't get geo_point....
reindex no use

No Use
POST /_refresh
POST /_flush/synced
POST /_cache/clear

Only do this can apply


Wast time Fxxx system.
..................
..................
..................
..................
..................
..................
..................
..................
..................
..................
..................
..................
..................
..................
..................

very bad document, very bad change version............Everythings is BAD for elk kibana



1、 Every time see this "PUT GET or DELETE" command. Use  where ???
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html


Use in Kibana 



AND Question is curl 




2、Please Watch 6.5   Not old version


You maybe see many document on Internet that check version First.



3、Before geo_point

keep this command : (or find Internet know this mean)

GET _cat/
GET _cat/indices?v
GET _cat/indices?v&s=index

GET /_settings

GET filebeat*

GET /_template

PUT _template/template_filebeat

POST _reindex


=================Begin================

Firest Must already have  default index




If want to auto, see  http://sueboy.blogspot.com/2018/11/kibana-default-index-pattern.html


Second



#!/bin/bash

echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories
echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
apk --no-cache upgrade
apk --no-cache add curl

echo "=====Elk config ========"
until echo | nc -z -v elasticsearch 9200; do
    echo "Waiting Elk Kibana to start..."
    sleep 2
done

code="400"
until [ "$code" != "400" ]; do
    echo "=====Elk importing mappings json ======="
    curl -v -XPUT elasticsearch:9200/_template/template_filebeat -H 'Content-Type: application/json' -d @/usr/share/elkconfig/config/template_filebeat.json 2>/dev/null | head -n 1 | cut -d ':' -f2|cut -d ',' -f1 > code.txt
    code=`cat code.txt`
    sleep 2
done

#reload index for geo_point
echo "=====Get kibana idnex lists ======="
indexlists=()
while [ ${#indexlists[@]} -eq 0 ]
do
    sleep 2
    indexlists=($(curl -s elasticsearch:9200/_aliases?pretty=true | awk -F\" '!/aliases/ && $2 != "" {print $2}' | grep filebeat-))
done

for i in "${indexlists[@]}"
do
    echo "=====reindex filebeat for geo_point ======="
    curl -v -XPOST "http://elasticsearch:9200/_reindex" -H 'Content-Type: application/json' -d'{ "source": { "index": "'$i'" }, "dest": { "index": "'$i-reindex'" } }'
done
    
#curl -XDELETE "http://elasticsearch:9200/filebeat-*"
#curl -XPUT "http://elasticsearch:9200/filebeat"

tail -f /dev/null




* template_filebeat.json  is from

GET _cat/indices?v
you can see some index like



GET filebeat-6.4.2-2018.11.19



ok use your mappings replace this mappings




{
  "index_patterns": ["filebeat*"],
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "doc": {
      "properties": {
        "@timestamp": {
          "type": "date"
        },

  ...

}


Only replace mappings. Official website have example.
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html

And  Change

"coordinates": {
"type": "float"  => "geo_point"
},
Save file name:template_filebeat.json  

Usually new docker elk logstash already have geoip. add_field like picture and mutate add some item. Here is change type with templates.



Back shell, move to  =====Get kibana idnex lists=====

This is get use indexlist now after used late.

Then reindex


Why do this Because reindex let  geo_point  remake.  Already inside index. corrdinates type is float.




If you want to change type, usually get error or maybe success, success is fake.





So only use reindex, let it can do.
https://medium.com/@sami.jan/fundamentals-of-elasticsearch-cbb273160f60


I think use docker elk logstash kibana that want to use quickly. Setting config must set default. Change config only use docker image offer. So docker image No offer and don't change docker image, only use API. But API not everything same use config.

All step

1、elk put template for geo_point

"coordinates": {
   "type": "geo_point"
},

2、get already used idnex

3、reindex  a -> a_reindex

4、Visualize ->  create a visualizaition -> Coordinate Map -> choese Filter  "filebeat-*"  Maybe your different name, by default index

-> Buckets -> Geo Coordinates -> Aggregation -> Geohash -> Field -> Geoip.coordinates  (geo_point)  -> RUN



Now 100% can see map.



[轉]聰明的投資者都是看財報,看法說會 財報、法說會在我心目中才是第一,這才是專業的人給出的結果,這種結果可信度就非常的高。

https://www.mobile01.com/topicdetail.php?f=291&t=5107288&p=1039#10381


聰明的投資者都是看財報,看法說會,一般網友說的會比較法說會及財報準嗎?我個人是不相信,所以我在追蹤一檔股票時,財報、法說會在我心目中才是第一,這才是專業的人給出的結果,這種結果可信度就非常的高


docker alpine

docker & docker-compose 一堆坑




FROM alpine

RUN apk --no-cache upgrade
RUN apk update &&\
apk add bash

docker-compose write file always root

Use chown 1000 xxxoo 

xxxooo file name






  logtest:
    build:
      context: logtest/
    volumes:
      - ./logtest/logs:./logs:rw
    networks:
      - elk
    command: |
      /bin/sh -c '/bin/sh -s << EOF
      echo "Start filebeat...."
      filebeat run -c ./filebeat.yml -v &
      sleep 2
      while [ ! -f ./logs/filebeat ]
      do
        sleep 2
      done
      chown 1000 ./logs/filebeat
      tail -f /dev/null
      EOF'


[轉]【踩坑】ELK6.0已取消filebeat配置document_type



http://blog.51cto.com/kexiaoke/2092029




解决方案为在filebeat里面新增一个fields字段,service : GameStatis都是自己定义的,定义完成后使用Logstash的if 判断,条件为if [fields][service] == "GameStatis".就可以了。



docker docker-compose run docker-compose.yml one part

docker-compose.yml


services:
  elasticsearch:

  logstash:

  kibana:

  nginx:




docker-compose run ngnix

docker-compose run kibana


two hex digits per byte

one byte = 8 bit

4 bit => hex 0000 2*2*2*2 = 16

so

one byte = 4bit + 4bit = hex + hex

sleep async await

https://gist.github.com/danharper/74a5102363fbd85f6b67



async () => {
  console.log('a');
  await sleep(1000);
  console.log('b');
}

mocha supertest geth mine


1、node & npm

apk add nodejs npm nano curl


2、mkdir t   put files to t or nano test.js

2.1、nano test.js



var supertest = require('supertest');

describe('GET http://go-ethe:8545/', function () {

    let request = supertest('http://go-ethe:8545')
    it('respond with json 1', function (done) {
        request.post('/')
            .send({"jsonrpc":"2.0","method":"miner_start","params":[1],"id":1})
            .expect('Content-Type', /json/)
            .expect(200, done);
    });

    let gethcmd = {"jsonrpc":"2.0","method":"eth_mining","params":[],"id":1}
    it('respond with json mining actively start ', function (done) {
        request.post('/')
            .send(gethcmd)
            .expect('Content-Type', /json/)
            .expect(200)
            .expect((res)=>{if (!(true == res.body.result) ) throw new Error("mining actively start failed!"); })
            .end(done);
    });

    it('respond with json 2', function (done) {
        request.post('/')
            .send({"jsonrpc":"2.0","method":"miner_stop","params":[],"id":1})
            .expect('Content-Type', /json/)
            .expect(200, done);
    });

    let gethcmd2 = {"jsonrpc":"2.0","method":"eth_mining","params":[],"id":1}
    it('respond with json mining actively stop ', function (done) {
        request.post('/')
            .send(gethcmd2)
            .expect('Content-Type', /json/)
            .expect(200)
            .expect((res)=>{if (!(false == res.body.result) ) throw new Error("mining actively stop failed!"); })
            .end(done);
    });

});



3、npm init -y && npm i -S supertest mocha


4、npm init get .node_modules directory, npm i -S get mocha & supertest

RUN> ./node_modules/mocha/bin/mocha test.js





====================
https://willi.am/blog/2014/07/28/test-your-api-with-supertest/


request.
    .get('/')
    .expect({message: "Hello, World!"}, done);

This way {ooxx: ooxx, ooxx: ooxx} must put all detail.


====================
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"miner_start","params":[1],"id":1}' go-ethe:8545


curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"miner_stop","params":[],"id":1}' go-ethe:8545


Method
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining

關在廁所中

這時外資群若想出脫要怎麼出?宏碁在23時,離淨值這麼遠,華碩都在淨值了,佳世達了不起一年的眼光費,宏碁還要四年的眼光費,目前大力的砍,大力的殺,外資群企圖引出買盤,這樣才有機會再進一步的出脫手上的股票,當有人進來了,再來慢慢的演一場八點檔

有一部經典港劇,鄭少秋和劉青雲主演的,故事說一個空方大鱷在狙擊港股,找了鄭少秋和劉青雲父子檔來股市操盤要對抗大鱷,鄭少秋和劉青雲找來了大型上市櫃公司的老闆來,類似我們的台灣五十成份股,找了張忠謀,郭台銘,林百里…等,股市一開盤,鄭少秋和劉青雲開始放空,大鱷也開始放空,有人會覺得奇怪,不是對抗嗎?怎麼一起放空?兩大主力一起放空,股市當然一直跌,一直跌,這時大老闆很生氣說,叫你們對抗,你們怎麼聯合一起空?劉青雲和大老闆們說,你認為你們公司是垃圾嗎?沒有價值嗎?大老闆們生氣回答,當然不是垃圾,公司每年可以創造很高的營盈,這時劉青雲說,這不就得了,有價值的股票最終一定會引來中實戶及大戶的進駐,只是沒有人知道這些中實戶及大戶心中的價值區在哪,所以我們就測試,此持雙方持續放空,股市跌到到了某一個點後,不論雙方怎麼空,怎麼賣都跌不下去,此時劉青雲放手叫大家別放空,時間過了三分鐘,股市湧入大盤的買盤,來自已散戶,中實戶,大戶,此時劉青雲反手做多開始強力買進,最後空方大鱷就被抬出去了。

ethereum geth rpc Why The method miner_start does not exist/is not available

..............................................
..............................................
..............................................


go-ethereum

https://github.com/ethereum/go-ethereum/wiki/Management-APIs#miner




geth --rpcapi "db,personal,eth,net,web3" --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*" --rpcvhosts=*


So you want miner, need put "db,personal,miner,eth,net,web3"



curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"miner_stop","params":[],"id":1}' go-ethe:8545


{"jsonrpc":"2.0","id":1,"result":null}


Fxxx Document...............................................


Import see this url document

web3

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining
https://github.com/ethereum/web3.js/

logstash kibana geth log ethereum Grok Constructor

filter


json {
  source => "message"
}

This mean is Try to use json format transfer log, then put some data to message filed. So some filed just be setting, and some data set to message.


.Use this to check mach and log
https://grokconstructor.appspot.com/do/match
https://blog.johnwu.cc/article/elk-logstash-grok-filter.html
https://github.com/logstash-plugins/logstash-patterns-core/blob/master/patterns/grok-patterns


This is geth log for example

A:
INFO [11-14|09:58:17.730] Generating DAG in progress epoch=1 percentage=99 elapsed=4m8.643s
INFO [11-15|01:41:33.455] Generating DAG in progress               epoch=1 percentage=9  elapsed=27.614s

B:
INFO [11-15|01:19:44.590] Loaded most recent local fast block      number=0 hash=656134…58fded td=1 age=49y7mo1h, Loaded most recent local fast block

C:
INFO [11-15|02:09:27.980] 🔨 mined potential block number=119 hash=ebaa58…5d8fa1, 🔨 mined potential block



A:

INFO [11-14|09:58:17.730] Generating DAG in progress epoch=1 percentage=99 elapsed=4m8.643s
INFO [11-15|01:41:33.455] Generating DAG in progress               epoch=1 percentage=9  elapsed=27.614s


%{DATA:logType} %{DATA:MONTHDAY} %{GREEDYDATA:message}\s+epoch=(?<epoch>\b\w+\b) percentage=(?<percentage>\b\w+\b)\s+elapsed=(?<elapsed>\b\w+\b)





B:

INFO [11-15|01:19:44.590] Loaded most recent local fast block      number=0 hash=656134…58fded td=1 age=49y7mo1h, Loaded most recent local fast block  


%{DATA:logType} %{DATA:MONTHDAY} %{DATA:message} number=(?<minedNumber>\b\w+\b) hash=(?<minedHashr>\b\w+...\w+\b) td=(?<minedtd>\b\w+\b) age=(?<minedtd>\b\w+\b)%{DATA:message2}





C:

INFO [11-15|02:09:27.980] 🔨 mined potential block number=119 hash=ebaa58…5d8fa1, 🔨 mined potential block




OK~ C is best easy. No any other special. Only need to check is Space. log have Space, rule must have Space. And Space must same count. Have one Space in log, rule must Have Space.


B is Data same and tail how to do.

%{DATA:message}
%{DATA:message2}

let two "Loaded most recent local fast block" to DATA & message、message2


B have one thing is C Space must same. Here firest %{DATA:message} Data:Loaded most recent local fast block.....   This is all Space in message. So %{DATA:message} & number= have space or not, just to test check. Don't think too much.


A \s+ is different. This is for some data have space, but log look just same. So use this \s+ for have more space. Remeber \s+epoch=  no space rule, NOT \s+ epoch= .  Only little different. Just to test check. Don't think too much.




All Architecture is like this

docker-compose  & elk
https://sueboy.blogspot.com/2018/11/docker-compose-ethereum-geth-private.html

Change logstach pipline -> logstash.log





Now very clear.

So some different is add_field that is for check grok is work ok or not. If kibana have value = grok is work.

add_field marked filed just for test, can open then get double smae filed and value.

Grok can multiple.



totolink t10 雙11 特價2,990

雙11 有Line 回鐀Line point 10%,另外信用卡3.5% ,其他 商店街有折300和1100,1100搶不到,折300也不錯。



放在三層樓中每層樓接近 樓梯和中間,靠樓梯來互通吧,每層前後都收得到,算不錯了!


使用中跨樓層不會中斷,但訊號不見得很強,算是便宜中的精品了。

kibana default index-pattern

先建立index-pattern,匯出index-pattern json檔,然後刪除建立index-pattern後,再由rest api匯入。

1、顯示 index-pattern 列表  (先用web建立一個index-pattern)

curl http://localhost:5601/api/saved_objects/_find?type=index-pattern


2、匯出saved_objects index-pattern

curl http://localhost:5601/api/saved_objects/index-pattern/c0c02200-e6e0-11e8-b183-ebb59b02f871 > export.json

c0c02200-e6e0-11e8-b183-ebb59b02f871 是 1找到的id

json檔匯出後不可以直接用,必需頭尾補上
header補上:

{
"objects": [


end補上:

]}


3、匯入saved_objects index-pattern  (記得先砍了kibana-*)

curl -v -XPOST localhost:5601/api/kibana/dashboards/import?force=true -H 'kbn-xsrf:true' -H 'Content-type:application/json' -d @./export.json

json放在執行curl 同目錄就可以了


4、強制設定預設值 Kibana -> Managment -> Advanced Settings  defaultIndex

curl -XPOST http://localhost:5601/api/kibana/settings/defaultIndex -H "kbn-xsrf: true" -H "Content-Type: application/json" -d '{"value": "id"}'

id from export.json inside have id value

If already open kibana website, use Fresh (F5) page again.



======docker-compose===============



Kibanaconfig:
    image: alpine
    volumes:
      - ./kibana/config/:/usr/share/kibana/config:ro
    command: 
      - /bin/sh 
      - -c 
      - |
        echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories
        echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories
        echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
        apk --no-cache upgrade
        apk --no-cache add curl 
        id="c0c02200-e6e0-11e8-b183-ebb59b02f871"
        
        echo "=====Kibana default index-pattern ========"
        echo "=====Wait Kibana======="
        until echo | nc -z -v kibana 5601; do
          echo "Waiting for Kibana to start..."
          sleep 1
        done
        
        echo "=====kibana import json======"
        code=""
        until [ $$code != 400 ]; do
          echo "=====kibana importing json ======="
          curl -v -XPOST kibana:5601/api/kibana/dashboards/import?force=true -H "kbn-xsrf:true" -H "Content-type:application/json" -d @/usr/share/kibana/config/export.json 2>/dev/null | head -n 1 | cut -d ':' -f2|cut -d ',' -f1 > code.txt
          code=`cat code.txt`
          echo "=====status code:$$code====="
          sleep 3
        done

        echo "=====kibana setting default index-pattern====="
        code=""
        until [ $$code != 400 ]; do
          echo "=====kibana setting ==================================="
          curl -v -XPOST kibana:5601/api/kibana/settings/defaultIndex -H "kbn-xsrf:true"  -H "Content-Type: application/json" -d '{"value": "$$id"}'  2>/dev/null | head -n 1 | cut -d ':' -f2|cut -d ',' -f1 > code.txt
          code=`cat code.txt`
          echo "=====status code:$$code====="
          sleep 3
        done
    networks:
      - elk
    depends_on:
      - elasticsearch




ELK


elasticsearch:
    build:
      context: elasticsearch/
    volumes:
      - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      ES_JAVA_OPTS: "-Xmx256m -Xms256m"
    networks:
      - elk

  logstash:
    build:
      context: logstash/
    volumes:
      - ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
      - ./logstash/pipeline:/usr/share/logstash/pipeline:ro
    ports:
      - "5000:5000"
    environment:
      LS_JAVA_OPTS: "-Xmx256m -Xms256m"
    networks:
      - elk
    depends_on:
      - elasticsearch

  kibana:
    build:
      context: kibana/
    volumes:
      - ./kibana/config/:/usr/share/kibana/config:ro
    ports:
      - "5601:5601"
    networks:
      - elk
    depends_on:
      - elasticsearch

Ray Tracy ZFS

Ray Tracy 一個工具或技術, 能否達到你的期望用途, 關鍵在於:

使用者是否充分了解他, 並且能夠熟練的駕馭他.

世上沒有絕對好用的工具, 也沒有絕對該用甚麼的場景:

我曾經深度挖掘 zfs 的各種參數, 試圖調到最好, 經過半年之後卻發現, 當我的 Workload 特性有細微改變的時候, zfs 會放大這些改變, 導致整個運作偏離我預想的方向....(其實就是參數過度優化: Over-optimized, 但我發現 zfs 的參數很容易讓你走上這條路)

這問題, 導致我必須經常監督 zfs 的表現, 並記錄我的 workload 每一個時間軸的變化趨勢, 好讓我在下周或下個月, 遇到新的問題時, 知道該朝甚麼方向改變甚麼參數, zfs 才能獲得最佳結果.

這對 Hacker 或 Geek 來說, 是件無比美好的事情, 因為他們每周都可以看到新的變化, 接受新的挑戰, 然後從當中挖掘出更多 zfs 新的參數組合與用途, 再來發表給大家聞香敬拜....

但對機房的 SRE 來說, 這件事情根本就是噩夢, 因為原本可以安穩睡一個星期的覺, 現在變成每天半夜都睡不著, 你不知道他是否會在半夜 3 點突然惡化, 導致線上有 50 萬個會員在交易的電商網站, 反應變慢, 破圖, 甚至無法交易, 最後被客戶從睡夢中挖起來解決問題.....

我也跟您一樣, 試圖解決 Storage 同步的問題, 而引進 Gluster 技術. 剛開始看似一切正常, 資料都正常複寫, 直到有一天, 某一台 node 意外故障而重開, 觸發 Gluster 開始做 healing 的時候, 我才發現:

- 他的 healing 比我預期的時間更長上數十倍
- 他在 healing 期間會造成 VM 寫入資料異常
- 他在 node 發生 flip-flap 的時候, 會選出錯誤的 node

這些問題難道都沒測試過嗎? 有啊, 但是我測試的時候, 並沒有出現這些現象, 國外人家測試的時候, 也沒有特別警告這些現象; 初期也都沒問題, 是跑了幾個月之後, 才開始劣化....

所以, 我從每天調校 zfs, 轉成每天要調校 Gluster, 參數又多如牛毛, 排列組合起來有上百種變化, 然後又是生產環境, 我不能隨便停下來測試, 每一次調整都得確保線上系統不會掛掉, 也不能隨便重開機...

如果當初我知道會有這麼多問題, 我絕對不會這麼快就讓他上生產環境, 至少要測到我有信心為止. 但是, 最初的測試都顯示: 他們似乎是個很好的選擇, 直到我上了生產環境之後數個月, 才開始出問題....

最後我回到傳統硬體 RAID +NFS, 當然這樣的效能無法滿足原先用 zfs 的期待, 不過我又自行加上 bcache 技術設法加速, 只是我選擇比較保守的參數, 以資料安全性為優先, 不追求最高效能; 初步看起來, 這樣大概可以滿足我現行的狀況還剩一點點餘裕, 至少, 他不會造成我整個 I/O 被 block 住, 連 CPU 都被吃死死不能動的狀況 (此問題我在 zfs 和 gluster 都遇到)

但是這個組合, 沒辦法解決跨 Storage replication 的問題, 也就是沒有 HA; 所以, 我勢必要跳離這個方案, 目前下一個候選者是 Ceph, 但過去幾年來, Ceph 有名的除了很容易做到大容量 Scale-out 和 Replication 之外, 還有一個眾人皆知的缺陷是: 效能低落, 所以, 我該如何解決效能低落問題, 同時享受他帶來的 Scale-out 好處? 並且, 在我的環境內可以正常工作?

我的經驗, 並不代表別人也是同樣的狀況, 你可以找到許多把 zfs 和 gluster 用得很愉快的用戶, 但是他們的 workload 和環境也跟我大不相同....

這些 Storage 的課題, 都需要在實際環境中實做過才會知道...














向聖夫 這種 fine tuning 必須從 application 層級開始 跑很多 micro service 才有可能針對每一個 micro service 去優化
.
但是如果你把所有的 workload 放在一個 vm 裡面, 你會發現 你的 write 變快了 但是犧牲了你的 read.... 這個時候怎麼優化都會出問題

你有 sequential write 其實需要的是 spinning disk 才快

你有 random write 小 io 這個是要 nvme ssd 才快 Ray Tracy 說的 bcache 很讚 但是它還是有誤判的情況 以及每一顆 nvme ssd 的 controller 能夠同時處理的 thread 跟 command 都不一樣 所以你優化 A 牌的參數換到 B 牌上去時 是完全沒路用

如果你仔細觀察 nvme ssd 下的 controller busy time 你就會發現 當ssd command 塞爆的時候 你會發現它比 hdd 還慘 ( 不是 ssd 上的 ram buffer 用光了喲)




docker iptables part 2

restart docker service iptables be reset

Docker Basic rule (New Docker maybe change somethings)

*nat
:PREROUTING ACCEPT [27:11935]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [598:57368]
:POSTROUTING ACCEPT [591:57092]
:DOCKER - [0:0]
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
COMMIT
# Completed on Sun Sep 20 17:35:31 2015
# Generated by iptables-save v1.4.21 on Sun Sep 20 17:35:31 2015
*filter 
:INPUT ACCEPT [139291:461018923]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [127386:5251162]
:DOCKER - [0:0]
-A FORWARD -o docker0 -j DOCKER
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
-A FORWARD -i docker0 -o docker0 -j ACCEPT
COMMIT
# Completed on Sun Sep 20 17:35:31 2015



Other firewall control

iptables -A INPUT -s xxx.xxx.xxx.xxx/32 -j ACCEPT
iptables -A INPUT -s xxx.xxx.xxx.xxx/16 -j ACCEPT
iptables -A INPUT -s xxx.xxx.xxx.xxx/8 -j ACCEPT

iptables INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
iptables INPUT -m state --state NEW -m tcp -p tcp --dport 8545:8560 -j ACCEPT



======CentOS RedHatOS 需注意事項======

RH-Firewall-1-INPUT
http://linux.vbird.org/linux_server/0250simple_firewall/0250simple_firewall-centos5.php
http://www.voidcn.com/article/p-xnzrlybo-bhv.html

預設規則中,INPUT 與 FORWARD 的規則一致,因此 CentOS 將兩條鏈的規則寫在一塊,變成一個自訂鏈 RH-Firewall-1-INPUT 的鏈!

-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT


Red hat独有的防火墙设置,把INPUT 和 FORWARD 链引到一起统一处理。所以在这种防火墙规则的前提下,增加防火墙规则时,必须把规则都添加到子链RH-Firewall-1 -INPUT中,这样才会生效,添加到父链中是没有效果的。

RH-Firewall-1 -INPUT chain的最後一條規則是:
-A
RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
拒绝所有其他不符合上述任何一条规则的数据包。并且发送一条host prohibited的消息给被拒绝的主机。

解法:-A INPUT -> -A RH-Firewall-1-INPUT

另一種方式
http://blog.ihipop.info/2010/03/705.html

-I INPUT  移到 -A RH-Firewall-1-INPUT 上方
-I :插入一條規則。如果沒有指定此規則的順序,預設是插入變成第一條規則。



https://dywang.csie.cyut.edu.tw/dywang/linuxserver/node24.html

.不啟動 NAT 功能的 Linux 主機,只要使用過濾表格 filter 的 INPUT 及 OUTPUT 鏈就夠了

.啟用 NAT 主機,除過濾功能外,還要考慮 FORWARD 轉送功能,且要使用位址轉換表格的 POSTROUTING 鏈,將符合規則的封包,其封包位址由內網私有 IP 偽裝 (MASQUERADE) 成 NAT 對外 IP,才能連上網際網路

docker iptables

http://blog.pulipuli.info/2011/07/




http://linux.vbird.org/linux_server/0250simple_firewall.php

iptables [-AI 鏈] [-io 網路介面] [-p tcp,udp] \
> [-s 來源IP/網域] [--sport 埠口範圍] \
> [-d 目標IP/網域] [--dport 埠口範圍] -j [ACCEPT|DROP|REJECT]
選項與參數:
--sport 埠口範圍:限制來源的埠口號碼,埠口號碼可以是連續的,例如 1024:65535
--dport 埠口範圍:限制目標的埠口號碼。


[root@www ~]# iptables -A INPUT [-m state] [--state 狀態]
選項與參數:
-m :一些 iptables 的外掛模組,主要常見的有:
     state :狀態模組
     mac   :網路卡硬體位址 (hardware address)
--state :一些封包的狀態,主要有:
     INVALID    :無效的封包,例如資料破損的封包狀態
     ESTABLISHED:已經連線成功的連線狀態;
     NEW        :想要新建立連線的封包狀態;
     RELATED    :這個最常用!表示這個封包是與我們主機發送出去的封包有關

範例:只要已建立或相關封包就予以通過,只要是不合法封包就丟棄
[root@www ~]# iptables -A INPUT -m state \
> --state RELATED,ESTABLISHED -j ACCEPT
[root@www ~]# iptables -A INPUT -m state --state INVALID -j DROP



https://www.booleanworld.com/depth-guide-iptables-linux-firewall/
https://www.lammertbies.nl/comm/info/iptables.html



docker csf

https://meta.discourse.org/t/applying-docker-discourse-iptables-rules-when-using-csf-firewall/70531/5




csf v12.08



NOTE: This feature is currently in BETA testing, so may not work correctly

This section provides the configuration of iptables rules to allow Docker
containers to communicate through the host. If the generated rules do not
work with your setup you will have to use a /etc/csf/csfpost.sh file and add
your own iptables configuration instead

1 to enable, 0 to disable



ethereum private chain by ubuntu


https://gist.github.com/javahippie/efee5417c69aaad3baf297dd2cd71fc6



version: '3.3'

services:
  go-ethereum:
    build:
      context: go-ethe/
    ports:
      - "8545:8545"
      - "30303:30303"
    networks:
      - elk

networks:
  elk:
    driver: bridge




FROM ubuntu:xenial

RUN apt-get update \
     && apt-get install -y wget \
     && rm -rf /var/lib/apt/lists/* 

WORKDIR "/opt"
ARG BINARY="geth-linux-amd64-1.8.17-8bbe7207.tar.gz"
RUN wget "https://gethstore.blob.core.windows.net/builds/$BINARY"
RUN tar -xzvf $BINARY --strip 1
RUN rm $BINARY

ADD ./genesis.json ./genesis.json
RUN ./geth init genesis.json

CMD nohup ./geth  --dev --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*"  --mine 
#geth --syncmode "light" --cache=2048

EXPOSE 8545
EXPOSE 30303

docker-machine ssh login use putty or xshell or winscp

1、Get key


Key Path
c:\user\xxxooo\.docker\machine\machines\%%%%%

xxxooo user

%%%%%  machine name


id_rsa  This is key



2、Need vm ip、id_rsa


Get IP:
1. docker-machine ssh %%%%%
2. ifconfig


If need PPK:winscp can auto change id_rsa to ppk


3、last step login VM account:docker


===========

https://github.com/boot2docker/boot2docker


Docker Machine auto logs in using the generated SSH key, but if you want to SSH into the machine manually (or you're not using a Docker Machine managed VM), the credentials are:

user: docker 
pass: tcuser

docker-compose ethereum geth private chain

Suggestion is use docker-machine for make docker machine is more easy. VirtualBox

windows Use HFS.exe for copy file to docker machine instance.




Directory < ethtest >
||=docker-compose.yml
||=< go-ether >
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp||=Dockerfile
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp||=start.sh
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp||=< genesis >
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp||=genesis.json


1、docker-compose.yml

import:

.keystore maybe no use, because run again docker-compose need to delete /go-ether/keystore
.entrypoint must have together Dockerfile ENTRYPOINT



version: '3.3'

services:
  go-ether:
    build:
      context: go-ether/
    volumes:
      #- ./go-ether/keystore:/root/.ethereum/devchain/keystore:rw
      - ./go-ether/genesis/genesis.json:/root/genesis/genesis.json:ro
      - /etc/localtime:/etc/localtime:ro
    entrypoint: /root/start.sh
    ports:
      - "8545:8545"
      - "30303:30303"
      - "30303:30303/udp"
    networks:
      - elk

networks:
  elk:
    driver: bridge




2、Dockerfile

import:

.COPY or ADD is ok
.Only start.sh is important, other line is for test and note
.Super important is start.sh file must end LF
https://sueboy.blogspot.com/2018/11/docker-compose-standardinitlinuxgo190.html




FROM ethereum/client-go:alltools-latest

RUN apk update &&\
    apk add git nodejs bash perl

#ADD ./genesis/genesis.json /root/genesis/genesis.json
#RUN geth init /root/genesis/genesis.json --datadir "~/.ethereum/devchain"

#RUN geth --dev --rpcapi "db,personal,eth,net,web3" --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*" --mine 
#geth --syncmode "light" --cache=2048
#./geth --datadir /root/.ethereum --password /root/geth.password --unlock "0" --port 30310 --rpc --rpcaddr "0.0.0.0" -rpcapi "eth,web3" --rpcport 8110 --networkid 4567890 --dev --lightkdf --nodiscover --maxpeers 0 --verbosity 6 --pprof --pprofport 6110 $@ 2> /tmp/geth.log

COPY start.sh /root/start.sh
RUN chmod +x /root/start.sh

ENTRYPOINT /root/start.sh







3、start.sh

import:

.last geth must have --minerthreads=1 , only --mini is can't mining. --mini login check geth.mining get true, but still no mining.




#!/bin/bash
set -e
datadir="~/.ethereum/devchain"
ip=$(echo `awk 'END{print $1}' /etc/hosts`)

echo "======== geth ========"
echo "======== init ========"
geth --datadir=$datadir init "/root/genesis/genesis.json"

sleep 2
echo "======== bootnode ========"
#bootnode -nodekeyhex 08f0e1dee5c1b4645f3331a566009e41a4514b6cd28656d63d0449ecf812812b &
bootnode --genkey=boot.key
bootnode --nodekey=boot.key -verbosity 4 &
#bootnode --nodekey=boot.key  -writeaddress > bootnodeid.txt

sleep 2
echo "======== account ========"
echo "password" > ~/.accountpassword
echo "df504d175ae63abf209bad9dda965310d99559620550e74521a6798a41215f46" > ~/.privatekey
geth account import --datadir=$datadir --password ~/.accountpassword  ~/.privatekey

sleep 2
echo "======== mine ========"
#bootnodeId="enode://76a8171707eca17647a47ca99ffd348927dfa60102792ea349a25d5192e61855be83b786e376276a306afcceea4ffd1c9c77e4370b417efc39f328a0d068004c@127.0.0.1:30301"
bootnodeId="enode://"$bootnodeid"@"$ip":30301"
address="8cc5a1a0802db41db826c2fcb72423744338dcb0"
echo "bootnodeID:"$bootnodeId
geth --datadir=$datadir --bootnodes $bootnodeId --networkid 45671 --rpcapi "db,personal,eth,net,web3" --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*"  --password ~/.accountpassword --etherbase $address --mine --minerthreads=1 2>geth.log





4、genesis.json



{
  "config": {
      "chainId": 45671,
      "homesteadBlock": 0,
      "eip150Block": 0,
      "eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000",
      "eip155Block": 0,
      "eip158Block": 0,
      "byzantiumBlock": 0
  },
  "nonce": "0x0000000000000042",
  "timestamp": "0x00",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "extraData": "0x00",
  "gasLimit": "0x4c4b40",
  "difficulty": "0x0001",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "alloc": {
  }
}





important:

1、genesis.json chainId & start.sh networkid must same.

2、datadir must have and same. If datadir different or no set, maybe can use same geth chain.

3、log must 2>geth.log 2>xxxooo.log xxxooo is log name.

4、--bootnodes maybe can have or not. Here is for demom, can try.



=====easy command=====

=====docker-machine=====
docker-machine --driver=virtualbox machine1 --virtualbox-memory 2048 --virtualbox-cpu-count 2 --engine-opt dns=8.8.8.8

docker-machien start machine1
docker-machien ssh machine1
docker-machien stop machine1

Move machine1 hdd to D: , stop first then use VirtualBox Media manager, don't change ini or config file.

=====docker-machine=====


=====copy edit txt file=====
On windows use HFS.exe put file into HFS.

rm -f docker-compose.yml && wget http://ip address/docker-compose.yml

rm start.sh -f && wget http://ip address/start.sh && rm -f Dockerfile && wget http://ip address/Dockerfile && rm genesis/genesis.json -f && wget -O genesis/genesis.json http://ip address/genesis.json

=====copy edit txt file=====



=====docker-compose=====
sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

.clear cache
chose 1:docker-compose rm -f && docker-compose pull && docker-compose up --build -d && docker-compose up
chose 2:docker-compose up --force-recreate

I use chose 1.
=====docker-compose=====



======login docker======
docker ps

xxxooo is docker container id, can use three or four word to login

docker exec -it xxxooo /bin/sh or /bin/bash Exit CTRL + P CTRL + Q
docker exec -it xxxooo geth attach ipc://root/.ethereum/devchain/geth.ipc

=====================


======login geth======
xxxooo is path, so "find / -name geth.ipc"

geth attach ipc:./xxxooo/geth.ipc


eth.accounts have account?
eth.mining can mining?
eth.blockNumber mining?
eth.getBalance(eth.accounts[0]) have ether coin?


$@ linux shell




http://jyhshin.pixnet.net/blog/post/39349999-shell-script-%E8%87%AA%E5%8B%95%E5%AE%9A%E7%BE%A9%E7%9A%84%E8%AE%8A%E6%95%B8



$@ 包含所有輸入的參數,$@ 即代表 $1, $2,....直到所有參數結束。$@ 用將所有參數以空白為間隔,存在 $@ 中。也就是說 $@ 代表了 "$1" "$2" "$3"....。

ethereum private chain 私有鏈

https://github.com/ethereum/go-ethereum/wiki/Private-network

https://medium.com/taipei-ethereum-meetup/%E4%BD%BF%E7%94%A8-go-ethereum-1-6-clique-poa-consensus-%E5%BB%BA%E7%AB%8B-private-chain-1-4d359f28feff

https://blog.fukuball.com/ethereum-%E9%96%8B%E7%99%BC%E7%AD%86%E8%A8%98-22geth-%E5%9F%BA%E7%A4%8E%E7%94%A8%E6%B3%95%E5%8F%8A%E6%9E%B6%E8%A8%AD-muti-nodes-%E7%A7%81%E6%9C%89%E9%8F%88/



https://medium.com/@javahippie/building-a-local-ethereum-network-with-docker-and-geth-5b9326b85f37


https://mshk.top/2017/11/go-ethereum-1-7-2/

https://www.tiny-calf.com/2018/02/01/GETH%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%9F%BA%E6%9C%AC%E6%93%8D%E4%BD%9C/


https://neighborhood999.github.io/2018/09/19/running-ethereum-on-docker/


https://github.com/yutianwu/ethereum-docker

https://github.com/yutianwu/ethereum-docker



ethereum eth --dev & networkid & chainId doesn't work with a custom genesis block

https://github.com/ethereum/go-ethereum/issues/15182



@robert-zaremba You can still use dev with datadir. Dev just uses a 0-period clique chain.

That said, --dev was not meant to be used on custom networks / genesis blocks. If you need a custom setup, you can init a chain of your choosing. Dev will try to be smart and configure a lot of stuff for easy testing, but it's not flexible, it's easy.



翻譯:

--dev不能用在 custom networks 和genesis blocks.



=========== Error understand ============

--dev  => 1337

So  use --dev  must networkid & chainId     set 1337 

docker-compose standard_init_linux.go:190: exec user process caused "no such file or directory"

docker-compose  Dockerfile always run script failed, many document is talking about

RUN chmod +x   xxxooo.sh

But still can't run, get error every time.

Answer:

Use notepad++, go to edit -> EOL conversion -> change from CRLF to LF.



standard_init_linux.go:190: exec user process caused "no such file or directory"

https://stackoverflow.com/questions/51508150/standard-init-linux-go190-exec-user-process-caused-no-such-file-or-directory




dockerfile RUN WORKDIR !!!!



https://yeasy.gitbooks.io/docker_practice/image/dockerfile/workdir.html



WORKDIR 指定工作目录

格式为 WORKDIR <工作目录路径>。

使用 WORKDIR 指令可以来指定工作目录(或者称为当前目录),以后各层的当前目录就被改为指定的目录,如该目录不存在,WORKDIR会帮你建立目录。

之前提到一些初学者常犯的错误是把 Dockerfile 等同于 Shell 脚本来书写,这种错误的理解还可能会导致出现下面这样的错误:RUN cd /app RUN echo "hello" > world.txt


如果将这个 Dockerfile 进行构建镜像运行后,会发现找不到 /app/world.txt 文件,或者其内容不是 hello。原因其实很简单,在 Shell 中,连续两行是同一个进程执行环境,因此前一个命令修改的内存状态,会直接影响后一个命令;而在 Dockerfile 中,这两行 RUN 命令的执行环境根本不同,是两个完全不同的容器。这就是对 Dockerfile 构建分层存储的概念不了解所导致的错误。

之前说过每一个 RUN 都是启动一个容器、执行命令、然后提交存储层文件变更。第一层 RUN cd /app 的执行仅仅是当前进程的工作目录变更,一个内存上的变化而已,其结果不会造成任何文件变更。而到第二层的时候,启动的是一个全新的容器,跟第一层的容器更完全没关系,自然不可能继承前一层构建过程中的内存变化。

因此如果需要改变以后各层的工作目录的位置,那么应该使用 WORKDIR 指令。

ethereum/client-go

https://geek.ink/forum/detail/34



entrypoint cmd command docker-compose



https://medium.freecodecamp.org/docker-entrypoint-cmd-dockerfile-best-practices-abc591c30e21

Step


First

Dockerfile ENTRYPOINT use all uppercase letters 

Docker Compose entrypoint  use lowercase letters.


Second

CMD / command
The main purpose of a 

CMD (Dockerfiles)
command (Docker Compose files) 

is to provide defaults when executing a container. These will be executed after the entrypoint.


===================
https://beginor.github.io/2017/10/21/dockerfile-cmd-and-entripoint.html




[轉]linux exec与重定向

http://xstarcd.github.io/wiki/shell/exec_redirect.html

ethereum geth to log



https://ethereum.stackexchange.com/questions/3229/geth-what-happened-to-logfile


geth 2> file




Example:


geth --dev --rpcapi "db,personal,eth,net,web3" --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*" --mine 2>eth_output.log




.Dockfile

RUN geth --dev --rpcapi "db,personal,eth,net,web3" --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*" --mine 2>eth_output.log


===========

Have console & log & mining

./geth --datadir ./node2/data/ --networkid 55555 --port 30303 --rpcapi=db,eth,net,web3,personal,web3 --rpc --rpccorsdomain=* --password password.txt --mine --minerthreads=1 --verbosity 3 console 2>> /var/log/geth.log

PS:--rpccorsdomain=*  or --rpccorsdomain "*"  is ok,  --rpcorsdomain * is bad


Have console & log & mining & unlock

./geth --datadir ./node2/data/ --networkid 55555 --port 30303 --unlock 0x00000d0000b0000a000a000a0000d00fb0a0fb0b --rpcapi=db,eth,net,web3,personal,web3 --rpc --rpccorsdomain=* --password password.txt --mine --minerthreads=1 --verbosity 3 console 2>> /var/log/geth.log

PS:0x00000d0000b0000a000a000a0000d00fb0a0fb0b  account id


Have console & log & mining & unlock & backgroud run

tmux

./geth --datadir ./node2/data/ --networkid 55555 --port 30303 --unlock 0x00000d0000b0000a000a000a0000d00fb0a0fb0b --rpcapi=db,eth,net,web3,personal,web3 --rpc --rpccorsdomain=* --password password.txt --mine --minerthreads=1 --verbosity 3 console 2>> /var/log/geth.log

In tmux

  [Ctrl + b] d
  exit

or
  [Ctrl + b] s 

Shell
tmux ls
tmux attach -t 0



Ethereum Network ID Chain ID

https://qiita.com/hm0429/items/224d420364b36cf43e85


[轉]基于Docker的Ethereum 开发环境搭建

http://yutianx.info/2017/10/07/2017-10-07-docker-ethereum/


https://github.com/Capgemini-AIE/ethereum-docker

docker-machine on windows

1、close hyper-v
https://ugetfix.com/ask/how-to-disable-hyper-v-in-windows-10/

2、install Virtualbox

3、install git

4、https://docs.docker.com/machine/install-machine/#install-machine-directly

git-bash

base=https://github.com/docker/machine/releases/download/v0.14.0 && mkdir -p "$HOME/bin" && curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" && chmod +x "$HOME/bin/docker-machine.exe"


5、
git-bash

docker-machine create --driver=virtualbox machine1
docker-machine -s d:\docker create --driver=virtualbox machine1

docker-machine list

docker-machine ssh machine1
        docker run hello-world
        docker-machine env machine1


https://hk.saowen.com/a/00c8a80e4a74fcf80111ba570f4db601e204c12f61e3109fec92cac8a15456ae


docker-machine -s d:\docker create --driver=virtualbox --virtualbox-memory=2048 --virtualbox-cpu-count=2 --engine-opt dns=8.8.8.8 machine_name_ooxxooxx





=====

http://sueboy.blogspot.com/2018/11/docker-machine-ssh-login-use-xshell-or.html

user: docker
id_rsa

ethereum private node chain

1、geth
https://blog.fukuball.com/ethereum-%E9%96%8B%E7%99%BC%E7%AD%86%E8%A8%98-22geth-%E5%9F%BA%E7%A4%8E%E7%94%A8%E6%B3%95%E5%8F%8A%E6%9E%B6%E8%A8%AD-muti-nodes-%E7%A7%81%E6%9C%89%E9%8F%88/



2、Ganache one click blockchain
https://truffleframework.com/ganache

https://truffleframework.com/




3、MetaMask wallet

gin-jwt 又更新了 renew again



1、Authenticator

old:Authenticator: func(userId string, password string, c *gin.Context)

New

============================


type login struct {
Username string `form:"username" json:"username" binding:"required"`
Password string `form:"password" json:"password" binding:"required"`
}


Authenticator: func(c *gin.Context) (interface{}, error) {
var loginVals login
if err := c.ShouldBind(&loginVals); err != nil {
return "", jwt.ErrMissingLoginValues
}
userID := loginVals.Username
password := loginVals.Password



2、authMiddleware

old:
authMiddleware := jwt.GinJWTMiddleware{

New

authMiddleware, err := jwt.New(&jwt.GinJWTMiddleware{

[轉]linux改時區



https://blog.keniver.com/2017/06/linux-%E8%A8%AD%E5%AE%9A%E4%BF%AE%E6%94%B9%E6%99%82%E5%8D%80/





sudo dpkg-reconfigure tzdata

vue

[Vue.js] 簡單登入頁面路由part1
https://yuugou727.github.io/blog/2017/11/11/vue-login-practice/

[Vue.js] 簡單登入頁面路由part2
https://yuugou727.github.io/blog/2017/11/14/vue-login-practice-2/



[Vue.js] global method 的復用
https://yuugou727.github.io/blog/2017/11/25/vue-global-methods/

vue 模塊 2

https://zhuanlan.zhihu.com/p/22945985


ECMAScript目前包含一个名为ECMAScript 6 module loader API 的解决方案。简单来讲,这个解决方案允许你动态加载模块并缓存。







https://link.zhihu.com/?target=https%3A//github.com/ModuleLoader/es6-module-loader

vue 模塊

https://zhuanlan.zhihu.com/p/22890374

原生JS



[轉]Why (and How) we Left App Engine After it Almost Destroyed Us

https://hackernoon.com/why-and-how-we-left-app-engine-after-it-almost-destroyed-us-40ac2fc0b1a8

公司基本



https://www.mobile01.com/topicdetail.php?f=291&t=5107288&p=956



a大:先別急,投機有分,並不是所有的投機都是壞的,真正嚴格說你投資一間公司,那就是買進後都不要動,對於差價不在乎,只要領股息,目前很明顯我都不是這樣累積我的財富的,所以我才說我都是在投機。


要投機前,你要先搞懂股市中的規則,不然你的下場就會和我前五年一樣,這邊啃啃,那邊吃吃,自以為天下無敵,結果到頭來都是幫政府和券商當打工仔,過度交易把錢都賠光光了,最後絕望到買了年繳4萬2的保險,繳到現在繳了11年了,最終20年後多18%拿回來。年輕人本金二三十萬,說真的就算給你投機成功,每年賺2x%,3x%,6x%,9%,3x%,那又如何,以本金30萬來算,一年給你賺30%也不過9萬,以我之前為例,年年都賺很多%, 但金額還是少的可憐,所以你還是要先專注本業,讓你的本業幫你累積多一點的資金,以我為例,我每年本業賺到的錢,可以再投入股市,以30萬,40萬,50萬,60萬,60萬這種速度把錢投入股市,愈到後面時,你會發覺%數就算不多,賺到的錢就變的蠻可觀的。

投機需要很高的專注力,功力,努力,一些年輕人想大賺特賺,但卻不懂得努力,結果最終都是進到股市中送錢,你想一件很簡單的事,我是宏碁的贏家,我在宏碁中連贏了七年,如果你在投機時,常常換股操作,因為太常換股了,所以對於投機公司的基本面都一知半解,你怎麼在宏碁中和我對戰,短線投機股票是人和人之間的對戰,誰的策略好誰就把錢拿走,如果你想要投機,那你手上就必需要有很多很多的口袋名單,你要把這些口袋名單徹底了解後,你投機勝算才會高,所以我才說投機需要很努力,因為你要花更多更多的時間去研究基本面,籌碼面,技術面,心理面,產業面及資金配置…等,當你口袋名單有15檔,你在同時追蹤時,當然就需要花比別人更多的時間。

我個人手上的觀察名單都是從台灣五十中選出來了,僅有幾檔是從中型一百選出來的,股本及市值都蠻大的,公司的股本大,公司基本面就會比較困難一些,所以這15檔就花了我大部份的精力,好在這些大型權值股我都觀察十幾年了,慢慢的,這些股票的習性我都習慣了,目前大概就是財報出來會觀察一下,真的有真正的在操作才會看籌碼面及觀察外資心理入,有想投機賺短線時,我就會更進一步的追蹤該公司。


你對公司了不了解?你可以問自已幾件事

1、公司的營收大概會多少,多少是好,多少是壞?
2、什麼會影響公司的營收,上下遊廠商是誰,什麼樣的報價會影響公司產品的獲利?
3、什麼樣的毛利率,營利率,獲利外資群,散戶會買單,在他們的心中什麼樣的獲利值多少股價?
4、公司是做什麼的,公司主要的優勢是什麼?公司的競爭對手是誰?公司的發展方向是什麼?
5、公司領導人能力如何?誠信如何?是否能帶領公司更上一層樓?
6、公司的子公司有哪些?每一季貢獻獲利有多少?
7、公司業外投資有哪些?哪些幣升或貶會造成影響?
8、公司是否有投入研發資金?有多少的折舊?多少的攤提?
9、公司是不是景氣偱環股?
10、公司所得稅的要繳幾%?
11、公司的法說會你是不是都會去看,看完後是否就能知道公司接下來的優勢或隱憂?
12、公司的淡旺季是幾月?
13、公司淨值多少?獲利多少?配息多少?幾年後你能以淨值買到公司?
14、買賣一次股票你要付出多少手續費?交易稅?
15、公司什麼時候融券強制回補?什麼時候配息?什麼時候開股東會?
16、公司是靠哪些產品賺錢的?該產品能賺多少年?有沒有持續推出新產品?
17、公司的財務體質如何?
18、融資槓桿是幾倍?融資利息是幾%?維持率多少你會斷頭?

以上我隨便提出幾項,如果你的口袋名單,這些問題都回答不出來,那你不是投機,你是送錢,真正比較保守的人就是投資,選幾檔大型權值股買了後就放著領息,每季,每年看一下配息及獲利是不是撐的住即可,投機要做的功課可多了,如果要去投機轉機股、妖股,主力股…等,那你就要有更高人一等的內線,基本能力或資金,一般來說,安全一點的投機就是選大型權值股然後投機,投機要投得好,很多功夫都是要高人一等的,如基本面,籌碼心,法人心理面,自我心理人,資金配置,產業面…等,我個人給你的建議是,給去把書看一看,雖然現在錢不多禁得起輸,但也不代表你和我前五年一樣拿真金白銀去換經驗,其實很多規則及知識書上都有,網路上也都查得到,基本功有了後,你的資薪差不多也開始變大了,那時功力也健全了,投機/投資起來就不容易再受傷害。

[轉]如何開口向老闆提加薪?



想學更多的東西,幫公司做更多的事情,更多的貢獻
目前的待遇和生涯規劃上(理想)還有一點落差
還是老闆能不能給我機會,讓我可以學習或是得到公司的賞識和加薪


https://youtu.be/fio69wUlIbw?t=1728








如果有機會進入貴公司工作,希望能和公司一起成長和學習,公司有公司規定,老闆也有預備合理的薪資,我願意接受老闆的安排,盡力表現會讓您和公司覺得物超所值,在那時候再請老闆幫我調整薪資,希望公司給我工作機會。

老闆,我對這個職位相當有興趣, 我相信老闆對於這個職位也預備有合理的薪資, 我願意接受老闆的安排,我也會盡力表現跟學習, 讓公司覺得我物超所值,那時候再請老闆幫我調整薪資,就可以了



https://youtu.be/07nUfZrEJlA?t=2940

聊聊921(前半段)....後半段聊(應徵時如何談薪資?)


大公司無效,薪資固定,功勞被上面拿走,穩定但無情,很容易被取代

[轉]github-重新定位-redis-的功能

https://blog.gslin.org/archives/2017/01/12/7076/github-重新定位-redis-的功能/



==============
https://tech.trivago.com/2017/01/25/learn-redis-the-hard-way-in-production/

頂樓會熱



https://www.mobile01.com/topicdetail.php?f=335&t=5560543&p=3




根本不須去求別人,況且隔熱漆有使用年限的問題
加上頂樓會熱原本就是你朋友自己的問題..
我教你朋友一個方法:自己在屋內天花板做隔熱,
其實這是保溫瓶的一種觀念,
保溫跟隔熱是一體兩面的作用,
要保溫就必須隔熱,降低冷熱交換效率,
夏天日曬屋頂溫度一定很高,
就算開冷氣,也會被屋頂透過的熱稀釋而效率變得很差,
因為冷氣都在冷卻屋頂的熱,
因此如何降低屋頂跟室溫之間進行熱交換就是重點!
此時如果在屋內天花板做一隔熱層就能降低開冷氣時
冷氣容易被屋頂的熱量稀釋問題,
我自己的做法就是:
找裝潢師傅先溝通自己的想法,
1:天花板先釘角材
2:在角材格子內先滿鋪玻璃隔熱棉(就是一種專門包冷氣風管的材料,一面是鋁箔一面是玻璃棉)
3:再釘上三分夾板(或石膏板)把原天花板封起來(這步驟通常師傅會跟2項同時施工)
4:最後再釘一層美化用的軟質隔熱藝術天花板(我自己選用進口的音響室專用木漿吸音洞洞板)+收邊就完工.
(假如預算沒問題日本進口的國際牌音響室專用吸音板最好,美觀隔熱吸音一次完成)

菲律賓

朋友實際情況
1、飯店房間:永遠都會有蟑螂(小隻、大隻),旁邊可能有火車、有快速道路吵
2、水電很貴:吹冷氣的話,一個月八九千上下吧
3、網路超爛:公司網路用都會有回應變慢情況,有時手機網路還比公司網路好,手機吃到飽的網路,到一定額度就會變慢速
4、外食:一個月花到1萬,公司有補助的話,會降低費用


=========

  1. 有賭牌?
  2. 9g工簽?
  3. 領美金?
  4. 包機票?
  5. 年假?
  6. 宿舍住到爽?
  7. 薪水稅後?
  8. 醫保?
菲律宾法律规定50k内薪水15%税务
70k是20百分比
90k是35%
100k以上好像是45%
这个个人薪资纳税比例
这就是为啥很多公司办理签证的合约都写35000peso的原因 因为这样个人纳税就是5000多peso左右



======

大陽城
鳳凰城
TC Gaming

Struct to Map by Tag

telegram Gopher 台灣
@winampmaker

https://play.golang.org/p/RObzlfjZSRi



func struct2Map(model interface{}, tagName string) map[string]interface{} {
 m := make(map[string]interface{})
 r := reflect.ValueOf(model)
 total := r.NumField()
 for i := 0; i < total; i++ {
         m[r.Type().Field(i).Tag.Get(tagName)] = r.Field(i).Interface()
 }
 return m
}



============================

"github.com/fatih/structs"

func StructtoMapbyTag(tr interface{}, tag string) map[string]interface{} {
  t := make(map[string]interface{}) //儲存處理過的m 
  s := structs.New(tr)
  m := s.Map() //先轉成map[string]interface{}
  for key, value := range m {
    t[s.Field(key).Tag(tag)] = value.(string)
  }
  return t
}

font size conversion px em

https://websemantics.uk/tools/convert-pixel-point-em-rem-percent/

https://websemantics.uk/articles/font-size-conversion/


Point Pixel Em Percent Keyword Default sans-serif
6pt 8px 0.5em 50% Sample
7pt 9px 0.55em 55% Sample
7.5pt 10px 0.625em 62.5% x-small Sample
8pt 11px 0.7em 70% Sample
9pt 12px 0.75em 75% Sample
10pt 13px 0.8em 80% small Sample
10.5pt 14px 0.875em 87.5% Sample
11pt 15px 0.95em 95% Sample
12pt 16px 1em 100% medium Sample
13pt 17px 1.05em 105% Sample
13.5pt 18px 1.125em 112.5% large Sample
14pt 19px 1.2em 120% Sample
14.5pt 20px 1.25em 125% Sample
15pt 21px 1.3em 130% Sample
16pt 22px 1.4em 140% Sample
17pt 23px 1.45em 145% Sample
18pt 24px 1.5em 150% x-large Sample
20pt 26px 1.6em 160% Sample
22pt 29px 1.8em 180% Sample
24pt 32px 2em 200% xx-large Sample
26pt 35px 2.2em 220% Sample
27pt 36px 2.25em 225% Sample
28pt 37px 2.3em 230% Sample
29pt 38px 2.35em 235% Sample
30pt 40px 2.45em 245% Sample
32pt 42px 2.55em 255% Sample
34pt 45px 2.75em 275% Sample
36pt 48px 3em 300% Sample

Header golang client get

Usually how to tech is



req, err := http.NewRequest("GET", "http://example.com", nil)

req.Header.Add("Authorize", "dswxswsxw")

resp, err := client.Do(req)



BUT  Have problem inside. So.... use this



headers := http.Header{
"Accept-Encoding": []string{"gzip, deflate"},
}

req, err := http.NewRequest("GET", url, nil)
req.Header = headers

client := &http.Client{}
resp, err = client.Do(req)




More Safe.

ffmpeg hls 2~3秒 rtmp

.2秒

ffmpeg -i rtmp://xxx/live/A1 -tune zerolatency -preset faster -vcodec libx264  -b:v 400k -s 720x450 -r 15 -acodec mp3 -g 2 -f ssegment -segment_format mpegts -segment_time 2 -segment_list playlist.m3u8 out%03d.ts

-r 15 帧速率
-s 720x450 分辨率
-b 500k  比特率

-gop 2
-segment_time 2

压缩快慢
-preset ultrafast,superfast, veryfast, faster, fast, medium, slow, slower, veryslow


.3秒

ffmpeg -i rtmp://xxxx/live/A1 -tune zerolatency -preset faster -vcodec libx264  -b:v 400k -s 720x450 -r 15 -acodec mp3 -g 1.5 -f hls -hls_list_size 2 -hls_time 1.5 -hls_wrap 4 playlist.m3u8

-hls_time n:
-hls_list_size n:设置播放列表保存的最多条目
-hls_wrap n:设置多少片之后开始覆盖

[轉]golang

https://segmentfault.com/a/1190000015323550

GraphQL golang

GraphQL

https://www.thepolyglotdeveloper.com/2018/05/getting-started-graphql-golang/

https://www.thepolyglotdeveloper.com/2018/05/maintain-data-relationships-resolvers-graphql-golang-application/

https://www.thepolyglotdeveloper.com/2018/07/jwt-authorization-graphql-api-using-golang/

rtmp

https://github.com/EasyDSS/EasyPlayer

https://github.com/daniulive/SmarterStreaming

[轉]車 神單業務



https://www.mobile01.com/topicdetail.php?f=618&t=5517840&p=4#40




分享一下自已遇到的二個神單業務,基本上自已換車都直接找他,可以信任也不怕比價!
1、在業界到少15年以上,但就是不接大主管職(專心經營自已的客戶及小團隊)。
2、每年上台領獎,不是全國前三,也至少是全國銷售全國十名內,換過車廠也一樣。
3、三年內一定換業務車,通常是公司獎勵車(我還沒看過他們二年沒換車的)
4、開出來的單不怕比價,通常比過三家營業或朋友介紹的業務還是他最便宜,(開單後幾乎不需要追蹤)
5、不推特仕車或領牌車(除非客人要求),單上外加的配件也全部都是原廠配件,保固期內有問題原廠出單保固換新(增加客戶信認)
6、保險一定退傭金,15%起跳(看險種及保額,第一年通常超過20%),保險一次列出三家的保險內容及費用給我比內容比價,汽車想整理出險一句話,原廠內整理到好(原廠櫃臺出明細表),也可以換大美或鍍膜。
7、保養約時間幾乎都搞的定,農曆年前1個禮拜內的原廠保養或檢修,一個月約都OK,
8、接電話一定馬上叫出客戶的名子
9、到家服務,車子的保養自已沒空跑的話,寫車子的保險單,都可以到家幫我接送車
10、車子有任何問題或事故,在附近的話一定有小團隊的人前來幫忙處理,在遠處的話也會積極處理(事故只需要打第一通給業務的電話,後面業務會幫忙處理並主動告知)。
11、不限自營品牌,沒有適合的車款不硬推,例如小團隊內自已做國產某牌、老公做進口高級某牌、團隊其他業務也有經營其他品牌。
12、服務不斷線,例如公司招待出國旅遊時,電話一定轉接其他小團隊內的業務。

為啥人家可以做到這樣還可以開出神單?
因為人家有固定的客戶群經營出信任感,回頭率高,介紹率高~
因為人家可以有信心每年可以簡單拿到最基本100臺以上的獎金,獎金和競賽獎金都有計算退入訂單內了~
因為人家訂單不怕比價,也不用外廠劣質零件,訂單簡單,簽約快速(不用煩客人客人比完價就知道最便宜了,還要談什麼?),還有別的業務報副廠零件一堆更便宜也不用攻擊,因為客戶是聰明人出保時就知道了。
因為人家經營好(勢力好),就是有辦法交車、保養、出保、出險排前面,
因為人家配合多,大品牌頂級隔熱紙不想在原廠貼沒關係,介紹一樣的品牌門市面大,服務好,技術好價格又便宜,

人脈=錢脈啊~~

[轉]Building a single binary containing templates

https://github.com/gin-gonic/gin/blob/master/examples/assets-in-binary/README.md

gin-jwt

1. Authenticator 回傳的 data
2. data 會丟入到 PayloadFunc
3. PayloadFunc 整理資料寫入 MapClaims
4. Authorizator 再拿 MapClaims 資料出來判斷


新版和舊版有地方不同

type xxxxx struct{
     aaaaaaa:string
}

1、
Authenticator: func(userId string, password string, c *gin.Context) (interface{}, bool) {

return xxxxx{aaaaaaa: ooooxxxx}   or   string


2、
PayloadFunc: func(data interface{})   jwt.MapClaims {

if v, ok := data.(xxxxx); ok {
  id = data.(xxxxx).aaaaaaa
}

return jwt.MapClaims{"aaaaaaa": ooooxxxx, "bbbbbbb": ooooxxxx}


3、
Authorizator: func(data interface{}, c *gin.Context) bool {

claims := jwt.ExtractClaims(c)
id := claims["aaaaaaa"].(string)

注意!  Here data is string   fmt.Println(reflect.TypeOf(data))



黑蘋果 Hackintosh

https://www.youtube.com/watch?v=h0rl1NpWgIw&index=8&list=PL_kqm4nEkYPsyJEqagiYK9G6uMoeayEM4&t=0s

[轉]為小米路由器3換個靈魂(Padavan)

http://www.badbuta.com/2018/06/02/%E7%82%BA%E5%B0%8F%E7%B1%B3%E8%B7%AF%E7%94%B1%E5%99%A83%E6%8F%9B%E5%80%8B%E9%9D%88%E9%AD%82%EF%BC%88padavan%EF%BC%89/

[轉]如何維持電腦桌前好姿勢?

https://www.youtube.com/watch?v=IGo7K8bRWgk

[轉]別說電玩害了你兒子:經過設計的電玩世界,和你親手幫兒子設計的人生有何不同?

https://buzzorange.com/techorange/2018/06/22/why-game-producers-son-is-not-addicted/

flutter

https://www.youtube.com/watch?v=GLSG_Wh_YWc

Stateless   vs   Stateful
https://youtu.be/GLSG_Wh_YWc?t=8840






https://youtu.be/GpLb2XvKv20?t=946




https://medium.com/@matthew.smith_66715/why-we-chose-flutter-and-how-its-changed-our-company-for-the-better-271ddd25da60




State
https://www.jianshu.com/p/ed9c3378e9cc

https://tw.saowen.com/a/cff1432eff1eb306314bd241f231b4d693eaaa5aaa5310df9015fc7a0e53c134

REST Client

https://marketplace.visualstudio.com/items?itemName=humao.rest-client

androdi 電視盒

有人推 h96 pro +



https://item.taobao.com/item.htm?spm=a1z10.5-c.w4002-18274100013.15.335b2dd2ok2ztM&id=551825429534


android 7.1的另一款

https://item.taobao.com/item.htm?spm=2013.1.w4004-18274100020.24.22d870be3f3Rmc&id=560351004511


還有RAM 4G +32G

https://item.taobao.com/item.htm?spm=a1z10.5-c.w4002-18274100013.17.602444dcuODOhi&id=563255815946

旗艦 評價



https://www.mobile01.com/topicdetail.php?f=588&t=5469913&p=2#18







崩壞+傳說問我就對了
我崩壞之神
賣過兩個花費超過40萬水晶帳戶全角色2S大畢業全武器大緊繃,現在退休玩兩隻小號


傳說A牌
堅持尋找真裡的玩家也是我
花費超過三個月時間錄影+上傳youtube驗證U11觸控亂跳問題 堪比HTC外包QC

我用過
ZENPHONE 3隻
HTC 5隻
小米2隻
三星6隻
現在用的IPHONE 8 +
以上都買旗艦
主要需求長時間打GAME
會打到機子燒到需要開冷氣和風扇直吹 繼續打的那種
其次聽音樂、FB、看新聞

給你我的評價
HTCM7 神
M8神
M9垃圾
M9+垃圾
E9+垃圾
HTC10 遊戲神+毛病多(幹裡老換完電池觸控斷點,這隻他媽超級燙)
U11超大神+毛病多(超長2年保固螢幕觸控亂跳已解決,和IPHONE8+遊戲玩起來根本一樣 所以給超大神)

三星 I9100 神 刷機後開起威能
note 4 神+毛病多 (大螢幕遊戲神+WIFI
S6 浮誇神 (造型主觀浮誇小啟智哈味,效能神但毛病小多)
S8 浮誇神 (造型主觀浮誇小啟智哈味,效能神但毛病小多)
S9 神神(錢很多可以考慮 效能神毛病小多小卡小延遲)

Zenphone 2 CP小神(剛出玩遊戲夠用,各種浮誇內建APP)
Zenphone 3 遊戲小神+毛病多(螢幕背光+APP各種小問題+組裝品質)
Zenphone 4 遊戲神+毛病多(自家APP好用但毛病多+遊戲神)

紅米note 5
小米5 評價和ASUS旗艦差不多 CP取勝 但毛病以安卓來說比HTC還多

賈伯斯的遺囑 8+ 用到現在覺得和安卓差異極小,而且人會變智障 下次會換回安卓


結論

崩壞三+傳說+照相

IPHONE8+>S9>U11

U11玩遊戲拍照雖然神,但各種毛病 我只能慘讓給三星

起碼三星品質真的穩,沒有HTC毛病這多

Zenphone5 不在同一起跑點 只能場外休息

以上不是浮誇 而是誠心建議

async await Promise.all

async getaaa()
async getbbb()
async getccc()


=======new way=======
async  refreshall(){

  await Promise.all( xxxxxx.map(async (value, index) =>{
    aaa = await getaaa()
  }))

  await Promise.all( xxxxxx.map(async (value, index) =>{
     bbb = await getbbb()

  }))


  await Promise.all( xxxxxx.map(async (value, index) =>{
    ccc = await getccc()
  }))

}

=======old way=======
async  refreshall(){

  await Promise.all( xxxxxx.map(async (value, index) =>{
    aaa = await getaaa()
    bbb = await getbbb()
    ccc = await getccc()

  }))

}


1. map usually return something, here just throw
2. if use foreach(), get error.  Like  foreach is not function, can't async await.

old way  aaa order is good, but bbb ccc order is bad.
new way  all aaa bbb ccc order is ok.

call by value call by reference object array push

Problem: 
array A   
A.push(item) 
item is object  from for or map or foreach....etc

show A  all add item is same.......


Solve:

var txxxxx = []  // xxxx is any word

=====loop start=====
txxxx[index] = item  //index is from for or map or foreach...etc

ot = {
   xxxx: txxxx[index]
}

A.push(ot)
=====loop end=====

vue watch v-for

Very easy things, but need some way to pass this difficult.


Problme is async await   if your problem  is this, now see how to do


1. template or web html

.any input v-model="filter_keywork"

.<p v-for="r in results"> {{r.aaa}} {{r.bbb}} </p>


2. var app   data:{
  filer_keywork: '',
  resuls: [],
}


3. methods:{
  getrows(){
    this.axios or any http get
  },
  async filteredRows(){
    this.results = await this.getrows()
  }
}

4.watch: {
  filter_keywork: function(){
    this.filteredRows()
  }
}



Watch filter_keywork changed to call method this.fileredRows().

This time methods can us async await get back resuls => this.results Then vue render. No async await .... vue sleep.

[轉]區塊鍊 blockshain bitcoin ethereum


非常好的說明 Block
https://www.youtube.com/watch?v=_160oMzblY8
https://anders.com/blockchain/


https://www.inside.com.tw/2018/05/16/monero-hard-fork-success

[轉]Golang 交叉编译跨平台的可执行程序 (Mac、Linux、Windows )

https://www.jisec.com/application-development/753.html


OS ARCH OS version
linux 386 / amd64 / arm >= Linux 2.6
darwin 386 / amd64 OS X (Snow Leopard + Lion)
freebsd 386 / amd64 >= FreeBSD 7
windows 386 / amd64 >= Windows 2000

 go env


Mac 下编译 Linux 和 Windows 64位可执行程序

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go



Linux 下编译 Mac 和 Windows 64位可执行程序

CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go




Windows 下编译 Mac 和 Linux 64位可执行程序

SET CGO_ENABLED=0
SET GOOS=darwin
SET GOARCH=amd64
go build main.go

SET CGO_ENABLED=0
SET GOOS=linux
SET GOARCH=amd64
go build main.go

golang []map[string]interface{} sqlx BUT

Golang often us []interface{} or map[string]interface{}

sqlx.Queryx Alternate Scan Types



rows, err := db.Queryx("SELECT * FROM place")
for rows.Next() {
  // cols is an []interface{} of all of the column results
  cols, err := rows.SliceScan()
}

rows, err := db.Queryx("SELECT * FROM place")
for rows.Next() {
  results := make(map[string]interface{})
  err = rows.MapScan(results)
}

So
func Sqlselectall(db1 *sqlx.DB, table string) []map[string]interface{} {

  rows, err := db1.Queryx("SELECT * FROM  " + table)
  if err != nil { }

  results := []map[string]interface{}{}
  for rows.Next() {
    result := make(map[string]interface{})
    err = rows.MapScan(result)
    results = append(results, result)
  }

  return results
}


BUT  results to json use c.JSON(http.StatusOK, results) get warning value


https://stackoverflow.com/questions/39391437/merge-two-or-more-mapstringinterface-types-into-one-in-golang

法人



http://stockresearchsociety.blogspot.tw/2018/05/57-1400.html




專業的機構,因為他們夠專業所以他們會創造很多名辭及指標去快速判斷公司是否如他們所預期的方向前進,

對於公司產品的競爭力外資群會看毛利率,
對於公司領導人管理能力外資群會看營利率,
對於公司財務長的能力外資會看業外收入,

很多人都會看財報,但他們就是判斷不出來什麼是好,什麼是不好,為什麼判斷不出來?因為他們不會去以某一個基準點去比較,這種感覺就像甲問乙說你老婆長的怎樣,乙回答說長的很漂亮,此時甲判斷出乙老婆長怎樣嗎?應該不行吧,因為

沒有一個基準去比較

,而且甲也不知道乙的品味是怎樣,所以甲無從得知乙的老婆長怎樣。

看完以上的故事後,我們得到一個結論,那就是

1、要嘛就是乙給甲一個比較的基準

2、要嘛就是甲經由平常的觀察去了解乙的品味

我們把這個故事平移到分析財報上面來,

1、要嘛就是我找一個基準點去比較這一季的財報

2、要嘛就是我平常去觀察外資群及法人對某種財報接受的程度以及會做出的反應

很多人分析財報會輸給我,其實你們是輸在第二點,你們不會觀察外資群及法人對某種財報的接受程度及會做出的反應,這也就是我常說的法人心理面。

宏碁第一季的毛利率是10.5%,營利率是1%,奇怪第一季不是淡季嗎?也不用促銷,正常來說毛利率應該要比去年第四季還要好,怎麼會比去年第四季差嗎?

去年第一季營收為560億,營業費用為49.97億,
今年第一季營收為548億,營業費用為52.32億,

疑~為什麼今年第一季營收比去年少,營業費用要比去年高呢?目前我們沒有看到整份的財報,但是
若是給外資群來看,他會下的結論就是
產品爭競力是不是變差了,所以毛利率才下降,
是不是管理不夠好,所以才會造成營收比較少,但營業費用卻上升。

札實的投資能力

札實的投資能力不是一天兩能可以達成,除了閱讀再閱讀,親身經歷一些股市的漲跌,投資沒有捷徑,沒有上帝指標,股市比的就是誰犯的錯少,誰的股市常識、知識足,要在股市中生存下來難度很高要學的東西很多如
1、基本面(財報,看出合理價格)=>每一季閱讀財報
2、籌碼面(看出三大法人心理及散戶心態)=>每天追蹤籌碼
3、技術面(投資人的均價,弱點在哪)
4、資金配置(修正錯誤)
5、風險管控(不融資,不過度放大槓桿)
6、三大法人,散戶心理面
7、自我心理面(強化本身的人性弱點)=>這三本書可以幫助你"投資心理學,金融心理學—驅動股市的真正力量,投資人的大腦革命"
8、了解領導者的能力,風格,誠信


看到這,也許有很多小散戶會說,哪來的這麼多美國時間去研究這個,最好是給我技術圖形,給我進出點,給我指標,給我價格,我簡簡單單的就能低買高賣,但是如果股市這麼簡單,就不會是10個投資人9個輸,投資本來就是不容易的事,就像當醫生要讀醫學院,當律師要讀法學院,當工程師要念工學院,這些職業賺到的錢都沒有在股市中多(如果你資金夠大的話),那憑什麼你什麼都不學就想輕易的在股市獲利?

cpu scaling freq cpufreq powersave

apt install cpufrequtils

more /etc/init.d/cpufrequtils

cpufreq-set -g powersave

cpufreq-info


=====

lscpu


cat /proc/cpuinfo | grep -i 'mhz'


grep -E '^model name|^cpu MHz' /proc/cpuinfo



cat /sys/devices/system/cpu/cpufreq/policy7/scaling_governor
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq


**performance
for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do [ -f $CPUFREQ ] || continue; echo -n performance > $CPUFREQ; done

**powersave
for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do [ -f $CPUFREQ ] || continue; echo -n powersave > $CPUFREQ; done

echo "powersave" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor



=====

資源 成本


公司對內部人員陛升還有外部人員空降這件事,可以決定主管的態度是把人當資源還是成本


資源會成長

成本要控制


不相信人是資源的人,內部的人資系統不太會有培訓的機制,寧願花大錢買不懂你文化的人進來