[轉]我花了一个五一终于搞懂了OpenLDAP

https://juejin.im/entry/5aec6ac46fb9a07ac3635884 如果你搜索OpenLDAP的安装指南,很不幸地告诉你,网上不管中文的英文的,90%都是错的,它们都还活在上个世纪,它们会告诉你要去修改一个叫做slapd.conf的文件,基本上看到这里,你就不用往下看了,这个文件早就被抛弃,新版的OpenLDAP里根本就没有这个文件!取而代之的是slapd.d的文件夹,然后另一部分教程会告诉你,让你修改这个文件夹下的某一个ldif文件,看到这里,你也不用往下看了,你又看到了伪教程,因为这个文件夹下的所有文件的第一行都明确地写着:『这是一个自动生成的文件,不要修改它!』你修改了它之后,它的md5校验值会匹配不上,造成更多的问题。你应该用ldapmodify来修改这个文件,而关于ldapmodify的教程,可以说几乎就没有!我一开始不知道面临这样荒谬的处境,很多运维人员是怎么活下来的,不过等我自己配通了以后,真的是累到连写教程的精力都没有了,好吧,我已经配通了,你们各人自求

2018-12-20 · 1 min · 2 words · Me

[轉]Huge performance hit on a simple Go server with Docker

https://www.reddit.com/r/golang/comments/8ojjoj/huge_performance_hit_on_a_simple_go_server_with/ Docker’s disk I/O was the bottleneck! Solved: Disk I/O was the problem. Even though I’m on Debian 9.4, changing to an in-memory sqlite allowed Docker to push 2.9k reqs/sec. Credits to /u/Willson50 for the amazing find! With file=dco.sqlite3?mode=memory, Docker can push ~2.9k req/sec. Other way: PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL; https://www.sqlite.org/wal.html

2018-12-20 · 1 min · 51 words · Me

xgo Go CGO cross compile sqlite

https://github.com/karalabe/xgo

2018-12-20 · 1 min · word · Me

ethereum poa docker-compose docker

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 node 1 node 2 signer 1 signer 2 all private key & address create by https://vanity-eth.tk/ check again private key & address by https://www.myetherwallet.com/#view-wallet-info node1 private key:138cbbfb21686ddc3b5ffeb2cfc83491175af68319977acb81d0ae93392c626c account address:e79d33e93bd888b35e055f1a12d876354729037b node2 private key:df0c39faccd3c9d6d10091932f2214b9d42e92bd07b64a1552d13d39a6a84122 account address:Bf95EAacf10BEA53f0a73955a7eFCE2fb4A4Ef1d signer1 nodekeyhex:fcc406a7344690f66c757cc2c9987e3e78bb01e33229f9877d48a7fecc2d6657 node address:256330933851d6d3c5f7326b01021553415a33cd5485e23bfbe35f6321e6e2f8373bb1c94933fdb3283a1a8b2b737587dd99c555029e65e173a3094daa39277c private key:d05bd152f3d71ff5f91830f3ccc1090fb670c7026ebf8c2136d4e5090d59398d account address:5921a4C1B13afbD4b61d63e9c7BD47741C47B176 signer2 private key:df504d175ae63abf209bad9dda965310d99559620550e74521a6798a41215f46 account address:8Cc5A1a0802DB41DB826C2FcB72423744338DcB0 docker-compose version: '3.3' services: go-ethereum-node1: build: context: go-ethereum-node1/ volumes: #- ./go-ethereum/keystore:/root/.ethereum/devchain/keystore:rw - ./go-ethereum-node1/genesis/poa_for_dev.json:/root/genesis/poa_for_dev.json:ro - /etc/localtime:/etc/localtime:ro #- ./go-ethereum/log:/root/log:rw entrypoint: /root/start.sh ports: - "18545:8545" - "30313:30303" - "30313:30303/udp" networks: - fastdev go-ethereum-node2: build: context: go-ethereum-node2/ volumes: - ./go-ethereum-node2/genesis/poa_for_dev.json:/root/genesis/poa_for_dev.json:ro - /etc/localtime:/etc/localtime:ro entrypoint: /root/start.sh ports: - "28545:8545" - "30323:30303" - "30323:30303/udp" networks: - fastdev go-ethereum-signer1: build: context: go-ethereum-signer1/ volumes: - ./go-ethereum-signer1/genesis/poa_for_dev.json:/root/genesis/poa_for_dev.json:ro - /etc/localtime:/etc/localtime:ro entrypoint: /root/start.sh ports: - "38545:8545" - "30333:30303" - "30333:30303/udp" networks: - fastdev go-ethereum-signer2: build: context: go-ethereum-signer2/ volumes: - ./go-ethereum-signer2/genesis/poa_for_dev.json:/root/genesis/poa_for_dev.json:ro - /etc/localtime:/etc/localtime:ro entrypoint: /root/start.sh ports: - "48545:8545" - "30343:30303" - "30343:30303/udp" networks: - fastdev mongo: image: mongo #restart: always environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: example volumes: - alldata:/data/db networks: - fastdev mongo-express: image: mongo-express #restart: always links: - mongo:mongo ports: - 8081:8081 environment: ME_CONFIG_MONGODB_ADMINUSERNAME: root ME_CONFIG_MONGODB_ADMINPASSWORD: example networks: - fastdev postgres: image: postgres #restart: always environment: PGDATA: /var/lib/postgresql/data/pgdata POSTGRES_USER: root POSTGRES_PASSWORD: example volumes: - alldata:/var/lib/postgresql/data networks: - fastdev mariadb: image: mariadb #restart: always environment: MYSQL_ROOT_PASSWORD: example volumes: - alldata:/var/lib/mysql networks: - fastdev adminer: image: adminer #restart: always ports: - 8082:8080 networks: - fastdev openldap: build: context: openldap/ command: [--copy-service, --loglevel, debug] environment: LDAP_ORGANISATION: "das-labor" LDAP_DOMAIN: "das-labor.org" LDAP_BASE_DN: "dc=das-labor,dc=org" LDAP_ADMIN_PASSWORD: "abc123" LDAP_CONFIG_PASSWORD: "abc123" volumes: - ./openldap/data/ldap/environment:/container/environment/01-custom - ./openldap/data/slapd/database:/var/lib/ldap - ./openldap/data/slapd/config:/etc/ldap/slapd.d #- ./openldap/certs:/container/service/slapd/assets/certs ports: - "389:389" - "689:689" networks: - fastdev phpldapadmin: image: osixia/phpldapadmin command: [--loglevel, debug] environment: PHPLDAPADMIN_LDAP_HOSTS: "openldap" ports: - "6443:443" networks: - fastdev volumes: alldata: networks: fastdev: driver: bridge geth Dockerfile all same ...

2018-12-19 · 7 min · 1377 words · Me

Flutter ionic framwork7

有寫一支離線APP(不需要網路),app有上架android和ios,andorid有開廣告,而ios賣出去一些。 一開始開發使用framework 7 (純javascrip、html、css),開發速度是最快的,照著官網教學做,顏色不大改、版型照用,真的很快,然後用codova包一包,就上架了,操作起來也順,介面看起來都很像ios,唯一的問題是要花時間了解fromework 7架構上,第一次使用當然很痛苦,痛點在於framework,優點在於 html、css、javascript自由。 整體開發時程:一周內肯定解決。 後來改版了,花一些時間了解ionic,發現ionic跟Framework7用法差不多,但卻可以使用ionic native跟底層溝通(不過實際上這支APP根本不用到native),硬生生加入一個底層開啟圖片的功能;ionic開發起來也是很快,因為還是html為主的方式,另外也有花時間了解react,和react不同是,一開始的jsx就一堆問題,不過這是在很早期react會發生的問題(現在已經沒有這些問題);除react外,Angular也同樣有花時間了解,那時 Angular 1 基本上也是放棄,因為太複雜、反人類… Angular 2在寶哥展示後,發現“真的“不反人類了,就決定可以用ionic;ionic開發快在Angular 2+的底層架構,實際開發中的痛苦點反而比Framework7少,畢竟有Framework7可以對照開發,只需要進行語法上的轉換,不用花心思在架構上,Angular也是可以用javascript,Framework7上的array、object可以直接照搬來使用,唯一花時間在 上廣告 和 圖片呼叫底層,有痛到。 一周內肯定解決。 ionic 2 -> ionic 3 ,基本上 印象中 1天內解決吧,處理一些不相容問題而已。 ionic 2或3 順暢度,覺得差不多,唯一碰到的是原生的元件,在中文顯示小標題時,有一點被裁到,這問題在網頁上看時是正常的,在app上看時是不正常,這令人很困擾,但也懶得再用css調整了,就是這問題成為往flutter開發前進的關鍵原因。 Flutter官方展示對我最重要的點:修改後即時更新顯示 和 Material的元件。 改版撰寫時期發現 即時更新顯示 正常情況下是沒問題,但會有失效的情況,最終還是要重新complie app,但這功能只要運作正常時,是非常好用,可以慢慢調整畫面,真的太好用了! 之前開發都是跟web相關,即使在web broswer看是正常的,套入app後還是要把所有的情況再點擊測試一次(會有網頁正常、APP不正常情況),撰寫過程中發現問題進行修正後,需要再度complie app,然後再執行再調整,重覆web模式,和原生android開發也差不多,app每次complie完再操作,再調整,再重來一次complie執行…一直循環 能即時更新這點……真的節省非常多的時間! 但!!! 這次使flutter開發卻是有始以來花費時間最久的,Dart…Flutter Framework,Widget…….開發總時間已經逼進三星期以上,現在也只不過開發80%而己。 1、圖片 要能兩指縮放,最終網上有大神有做出plug,但為了套到去,就花了一星期以上,先參考官方demo app,移值失敗,用大神才成功。好處:終於離開底層的縮放,也不是css或javascript假縮放。 2、搜尋 看了一堆demo後,官方有比較推的方式,照做,照完後,發現是有BUG的,可能官網的做法,最後的搜尋完的點選,是在同一頁,但實際肯定會nav push到新頁,回到搜尋頁後,就不能搜尋了,debug查了整整一天,試了各種方式後,放棄! 改找網路上土砲法,自己做搜尋在header,然後再參考官方控制操作,這樣終於改完了。這也是一周以上的時間。 3、文章式的顯示:多塊區域組合,這裡也是花一堆時間,ListView怎麼處理widget [] 和chrild、chrildren等等,這裡正式踢鐵版,卻更了解上述一些架構上的問題。 改版到這裡就花了三星期以上的時間,這樣開發不是一次三星期,而是下班後斷斷續續的開發,到現在還是沒開發完畢,以之前的開發經驗,接下來肯定有 1、admob 2、androdi ios 實際創建app問題 android應該最少,ios最多 真的開發的話,有時間壓力的話,ionic還是最快的,但為了app畫面精緻度,也許Flutter………

2018-12-17 · 1 min · 61 words · Me

ethereum-etl ethereumetl elk logstash kibana

all output columns with logstash filter { if [srctype] == "etl" { #[fields][srctype] csv { columns => [ "number", "hash", "parent_hash", "nonce", "sha3_uncles", "logs_bloom", "transactions_root", "state_root", "receipts_root", "timestamp", "extra_data", "transaction_count", "gas_limit", "size", "total_difficulty", "difficulty", "miner", "block_hash", "block_number", "transaction_index", "from_address", "to_address", "value", "gas", "gas_price", "input", "address", "bytecode", "function_sighashes", "is_erc20", "is_erc721", "log_index", "transaction_hash", "data", "topics", "cumulative_gas_used", "gas_used", "contract_address", "root,status" ] separator => "," remove_field => ["message"] #autodetect_column_names => true #have problems #autogenerate_column_names => true #have problems skip_empty_columns => true skip_empty_rows => true } }

2018-12-17 · 1 min · 82 words · Me

logstash fileds if

https://sueboy.blogspot.com/2018/11/elk60filebeatdocumenttype.html filebeat.yml - type: log paths: - /var/log/geth.log exclude_files: ['.gz$'] fields: srctype: "geth" pipleline logstah.conf if [fields][srctype] == “geth” { BUT fields_under_root: true - type: log paths: - /var/log/geth.log exclude_files: ['.gz$'] fields: srctype: "geth" fields_under_root: true if [srctype] == “geth” {

2018-12-17 · 1 min · 41 words · Me

ethereum-etl ethereumetl docker

docker-compose.yml version: '3.3' services: ethereum_etl: build: context: . volumes: - ./var/log/:/ethereum-etl/output:rw #- /root/go/src/github.com/ethereum/go-ethereum/build/bin/data:/ethereum-etl/ipc #failed ipc is interface not data networks: - etl networks: etl: driver: bridge DOCKERFILE FROM python:3.6-alpine MAINTAINER Eric Lim ENV PROJECT_DIR=ethereum-etl RUN mkdir /$PROJECT_DIR WORKDIR /$PROJECT_DIR RUN apk add --no-cache gcc musl-dev #for C libraries: RUN pip install --upgrade pip && pip install ethereum-etl #ENTRYPOINT ["python", "ethereumetl"] ENTRYPOINT ["ethereumetl"] CMD ["export_all", "-s", "0", "-e", "500000", "-p", "http://xxx.xxx.xxx.xxx:8545", "-o", "output"] -s -e -p -o see https://github.com/blockchain-etl/ethereum-etl ...

2018-12-17 · 1 min · 112 words · Me

[轉]只要fed還敢升息,你和我說經濟數據有多差,景氣有多壞,整體公司獲利不好…等,你打死我,我都不相信

https://www.mobile01.com/topicdetail.php?f=291&t=5107288&p=1079#10788 市場預期下星期三fed會再升息一次,利率範圍來到2.25% 至 2.5%,當初我說過,升息會提高投資的成本,但每一個人承擔利率的容忍度不同,所以每一次fed預期升息或是fed確定升息,都會有部份的資金從股市中撤出,市場預期這件事,所以短線的賣盤比買盤少,所以股價就會下跌,比較壞的主力或法人明知你有不得不撤出的壓力,就故意把股價壓的低低的向你買,當這些因fed升息的賣壓宣洩完後,股價會漲回去,但我說過,股價是由資金所堆出來的,市場上的資金減少,總體上指數一定會向下修正,投資人就會去嚴格審視個股,資金往較高殖利率的地方移動,往相對便宜的個股移動,往防守性的個股移動…等。 若以陰謀論來看美股,有可能是華爾街故意讓股市下跌,以股市去逼fed不要再升息,最好是這一次不要升,如果不行,下一次最好不要升,每次的升息,代表投資成本的增加,企業財務成本的增加,這對股價及公司獲利都會直接或間接的影響。大家應該如果看待fed升息或貿易戰對股市帶來的下修,我個人認為,如果你的資金不是幾億,幾十億,幾百億,你應該要樂觀的看待股市景氣偱環,樂觀的看待下一次財富重分配的機會,但我說過,股市下修的過程,你不會知道什麼是最低點,什麼是最高點,這時你只有小量的參與股市,你才會知道股市目前走到什麼地步,股市會不會修正?以及會修正到哪?這要視貿易戰最終的結果,我說過,fed升息是要讓景氣軟著陸,避免景氣過熱,泡泡吹的太大顆,讓景氣維持一定的水準前進,而惡化的貿易戰是讓景氣硬著陸,一口氣把景氣打到底,崩的速度快而且狠。 當初我說過,只要fed還敢升息,你和我說經濟數據有多差,景氣有多壞,整體公司獲利不好…等,你打死我,我都不相信,fed手上的經濟數據有多厚,他們是國家最高的資訊收集中心,收集到的資訊都是相對正確的,哪個分析師,哪個天神有他們資訊多,一旦fed不敢再升息,會放慢升息,這代表貿易戰的影響已經開始影響到經濟數據,這時也不需要過度緊張,中美貿易戰還在談,如果買到的點在價值區,在波動中你想要賣或抱都不會造成你太大的傷害,因為沒有人能預期什麼是最低點,所以最科學的方法就是在價值區你要小量佈局且持有,等待所謂的更低點或最低點時,你不至於會錯過相對值得買的價值區,而且你每持有一年,你都能得到公司配出來的股息,進而降低你的投資成本,降低你的投資風險。 所以股市漲上去或跌下去,對你來說你都有策略,漲的時候你手上有2成3左右的股票,買在10年線下,未來這筆投資長線你會得到不錯的報酬,如果貿易戰惡化,股市持續修正,股價跌到價值區打九折,打八折,打七折,打五折,你需要擔心嗎?當然不需要擔心,這些打九折,打八折,打七折甚至打五折的股票,這會成為你未來得到暴利的投資,重點是真的跌到那個點時,你手上要有資金能買進,這也是我常說資金配置的重要性。 也許你今年買在亞泥十年線2成3,一年後領了股息後,亞泥股價減了2點8元,那時股市修正到8800點,其實我們在9500點買進,扣到明年的除權息400500點後6,說不定才損失200點,一般新手覺得跌了700點好值得買,其實僅是跌了200點,但有跌的機會就會有漲的機會,如果股價一直撐在35年線之間,每一年手上有股票的人,成本就愈來愈低,完全空手的人就一直在場外說,快崩盤了,快崩盤了,十年後,真的跌到6000點,其實十年前持有的人也都還是賺50%以上。

2018-12-15 · 1 min · 8 words · Me

[轉]Install Python version 3 side by side with version 2 in Centos 7

https://stackoverflow.com/questions/45997541/install-python-version-3-side-by-side-with-version-2-in-centos-7 yum -y install https://centos7.iuscommunity.org/ius-release.rpm yum -y install python36u yum -y install python36u-pip pip3.6 install numpy

2018-12-14 · 1 min · 16 words · Me

visual studio code api rest client

REST Client

2018-12-13 · 1 min · 2 words · Me

[轉]知乎社区核心业务 Golang 化实践

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

2018-12-11 · 1 min · word · Me

[轉 fb]ssd ceph

你這顆的 DWPD 只有 0.3, 每天只能寫入 37GB 的資料, 很快就會爆了….Ceph 如果維運技術不夠好的話, 有時會不小心觸發 PG 移動, 每次移動 PG 就是上百 GB 的資料在寫入…. 給 Ceph 用的 SSD, 建議 DWPD 至少要 3 起跳, 最好是 10…

2018-12-11 · 1 min · 28 words · Me

flutter dart Map

Map<String, dynamic> all = <String, dynamic>{ ’n1’: {’name’: ‘大豆’, ‘img’: ‘c11_list_img’}, ’n2’: {’name’: ‘纖維’, ‘img’: ‘c12_list_img.jpg’}, ’n3’: {’name’: ‘天然蔬果’, ‘img’: ‘c13_list_img.jpg’}, };

2018-12-10 · 1 min · 22 words · Me

Gallium os ubuntu OpenFortiGUI OpenFortiGUI-runner

Install two part: OpenFortiGUI OpenFortiGUI-runner Port set maybe: 443 8443 10443

2018-12-10 · 1 min · 11 words · Me

ubuntu path golang

.bashrc last line: export PATH="/usr/local/go/bin:$PATH"

2018-12-10 · 1 min · 5 words · Me

flutter SearchDelegate have bug

showSearch(context: context, delegate: DataSearch()); When you click item to other page, this is mean use listView & listTitle onTap: () { Navigator.push( context, new MaterialPageRoute( builder: (BuildContext context) => new PcPage(item), ) ); }, Then back to SearchDelegate Search bar can input ! Demo No problem because only change buildResults. So show on same page is OK. But usually show to other details page.

2018-12-08 · 1 min · 64 words · Me

OpenFortiGUI

https://hadler.me/linux/openfortigui/

2018-12-08 · 1 min · word · Me

kibana geo_point How to Part 5

Oragin geoip { source => "filebeatserverip" target => "filebeatserveripgeoip" add_field => [ "[filebeatserveripgeoip][coordinates]", "%{[filebeatserveripgeoip][longitude]}" ] add_field => [ "[filebeatserveripgeoip][coordinates]", "%{[filebeatserveripgeoip][latitude]}" ] } mutate { convert => ["[filebeatserveripgeoip][coordinates]", "float"] } Delete add_field => [ “[filebeatserveripgeoip][coordinates]”, “%{[filebeatserveripgeoip][longitude]}” ] add_field => [ “[filebeatserveripgeoip][coordinates]”, “%{[filebeatserveripgeoip][latitude]}” ] convert => ["[filebeatserveripgeoip][coordinates]", “float”] geoip { source => "filebeatserverip" target => "filebeatserveripgeoip" } mutate { } ===== { "index_patterns": ["filebeat*", "heartbeat*"], "settings": { "number_of_shards": 1 }, "mappings": { "doc": { "properties": { "filebeatserveripgeoip.coordinates": { "type": "geo_point" } } } } } Change filebeatserveripgeoip.coordinates -> filebeatserveripgeoip.location ...

2018-12-07 · 1 min · 177 words · Me

geth log No Year

geth log mined INFO [12-07|13:04:44] 🔨 mined potential block number=1934700 hash=3f9161…88da7d only month-day ……. grok { match => ["message", "%{LOGLEVEL:logType} \[%{DATA:gethmm}-%{DATA:gethdd}\|%{DATA:gethtime}\] %{GREEDYDATA:tmessage} number=(?\b\w+\b) hash=(?\b\w+...\w+\b)"] add_field => ["gethdate", "%{[gethmm]}-%{[gethdd]} %{[gethtime]}"] } ruby { code => " tstamp = event.get('@timestamp').to_i event.set('epoch',tstamp) event.set('gethdate', Time.at(tstamp).strftime('%Y')+'-'+event.get('gethdate')) " } date { match => [ "gethdate" , "YYYY-MM-dd HH:mm:ss"] target => "gethdate" timezone => "Asia/Taipei" } Recreate index GET _cat/indices?v GET _cat/indices?v&s=index GET filebeat-6.5.1-2018.12.06 DELETE filebeat-6.5.1-2018.12.06 GET _cat/indices?v ...

2018-12-07 · 1 min · 82 words · Me