09 มิถุนายน 2563

git clone error "SSL certificate problem: unable to get local issuer certificate"

If you have your own git server with a self-signed SSL certificate, you may found error "SSL certificate problem: unable to get local issuer certificate" during clone your git repository because of the SSL certificate is not trusted.

You can fix this issue by running command "git config --global http.sslVerify false" to not verify the SSL certificate.

Then you can clone your git repository.

28 พฤษภาคม 2563

adding custom CSS to blogger

Blogger allows you to add custom CSS, such as a table with zebra style. 

You can do it by going to Blogger Theme Designer plage, select Advance > Add CSS, and then put your own custom CSS here.

After that, click "Apply to Blog" button.





On your creating blog page, you can switch to HTML and write html table with your custom class from the CSS above like this.



After publishing your post, the table will be rendered from your CSS like this.





รายละเอียด SSFX, SSF, RMF ล่าสุด


ที่มา Link

26 พฤษภาคม 2563

แหล่งบริจาคเงินผ่าน Mobile App โปร่งใส่ น่าเชื่อถือ

การบริจาคเงินออนไลน์นั้นทำได้สะดวก รวดเร็ว และง่ายมากๆ ซึ่งข้อดีต่างๆ เหล่านี้ทำให้เกิดกลุ่มมิจฉาชีพมากมายเข้ามาหาผลประโยชน์ ซึ่งการตรวจสอบความถูกต้องของข้อมูล และการติดตามข้อมูลนั้นทำได้ยากมาก

ขจกท ขออนุญาตแนะนำช่องทางการบริจาคเงินผ่าน Mobile App ที่โปร่งใสและน่าเชื่อถือ เพื่อให้เงินทุกบาทของผู้บริจาคนั้นถูกนำไปใช้ประโยชน์ได้จริงๆ ถึงผู้ที่เดือดร้อนจริงๆ และนอกจากนั้น ผู้บริจาคยังสามารถนำหลักฐานการบริจาคไปลดหย่อนภาษีได้อีกด้วย


  1. เทใจ: https://taejai.com
  2. Kplus: https://www.kasikornbank.com/th/promotion/pages/e-donation.aspx
  3. Airpay: https://airpay.in.th/app/faq/donation.html
  4. Truemoney: https://www.truemoney.com/donation/
  5. SCBEasy: https://www.scb.co.th/th/personal-banking/digital-banking/scb-easy/how-to/donation.html





25 พฤษภาคม 2563

MongoDB playground

MongoDB

MongoDB is a NoSQL database designed for storing and managing large volumes of unstructured or semi-structured data. Unlike traditional relational databases that use tables and rows, MongoDB stores data in flexible, JSON-like documents (called BSON), making it easier to scale and adapt to changing data models.

MongoDB official URL is https://www.mongodb.com



MongoDB playground

If you want to test your MongoDB query logic and try something without installing MongoDB database. You can use Mongo Playground online by going to website and play.



21 พฤษภาคม 2563

Vulnerability in RabbitMQ : disable cleartext authentication mechanisms in the amqp configuration, Golang

To fix the vulnerability in RabbitMQ : disable cleartext authentication mechanisms in the amqp configuration, follow these steps

Create self-signed certificate files

the easy way is cloning the repository https://github.com/michaelklishin/tls-gen  then

1. go to the cloned repository and goto basic directory

2. run make PASSWORD={your_password} CN={your_domain}, see image below


3. ca, server and client certificate files will be created, see image below



Configure RabbitMQ configuration file

your rabbitmq.conf should be configured like this

loopback_users.guest = false
listeners.ssl.default = 5671
ssl_options.cacertfile = path_to_ca_certificate.pem
ssl_options.certfile = path_to_server_certificate.pem
ssl_options.keyfile = path_to_server_key.pem
ssl_options.password = XXXXX
default_pass = XXXXX
default_user = XXXXX

* Note
listeners.tcp.default = 5672 must be removed
- ssl_options.password must match the certificate password from the step above
- a related document is available at https://www.rabbitmq.com/ssl.html

Configure the client

your client code (Golang) should be written like this

cfg := new(tls.Config)
cfg.InsecureSkipVerify = true
cfg.RootCAs = x509.NewCertPool()
ca, err := ioutil.ReadFile("path_to_ca_certificate.pem")

if err == nil {
cfg.RootCAs.AppendCertsFromPEM(ca)
} else {
return nil, err
}

cert, err := tls.LoadX509KeyPair(
"path_to_client_certificate.pem",
"path_to_client_key.pem",
)
if err == nil {
cfg.Certificates = append(cfg.Certificates, cert)
} else {
return nil, err
}

url := fmt.Sprintf(
"amqps://%s:%s@%s:%d",
"rabbit_user",
"rabbit_password",
"rabbit_host",
5671,
)
con, err := amqp.DialTLS(url, cfg)
if err != nil {
return nil, err
}

see related full Golang code at https://tinyurl.com/y6u9ack9

05 พฤษภาคม 2563

mongodb calculate active user x days using aggregate

sample code below is calculating 7 days active users

duration = 7; // active user 7 days

dateTo = new Date();
dateTo.setHours(0, 0, 0);

dateFrom = new Date();
dateFrom.setDate(dateTo.getDate() - duration);
dateFrom.setHours(0, 0, 0);

db.getCollection("users").aggregate( // collection users
[
{
$match: { // filter by "created"
created: { $gte: dateFrom, $lt: dateTo }
}
},
$group: {
_id: "id", // group by "id"
uniqId: { $addToSet: "$id" }, // get uniq "id" only
},
]
);

01 พฤษภาคม 2563

มนุษย์เงินเดือน พนักงานบริษัทเอกชน หลังเกษียณหรือตกงาน จะมีรายได้จากไหนบ้าง


 

มนุษย์เงินเดือน พนักงานบริษัทเอกชน หลังเกษียณหรือตกงาน จะมีรายได้จากไหนบ้าง


รายได้ที่เราได้แน่นอน

1. เบี้ยยังชีพผู้สูงอายุ

    • เดือนละ 500 - 1,000 บาท ตามช่วงอายุ
    • ต้องมีอายุ 60 ปีขึ้นไป



2. เงินบำนาญชราภาพ ประกันสังคม
    • ได้ตอนอายุ 55 ปี และสิ้นสุดความเป็นผู้ประกันตน
    • เริ่มต้นเดือนละ 3,000 บาท (ขึ้นกับระยะเวลาส่งเงินสมทบ ยิ่งส่งเยอะ ยิ่งได้บำนาญเยอะ สามารถดูรายละเอียดเพิ่มเติมได้ที่ Link)




เงินได้อื่นๆ 

ถ้าระหว่างที่เราทำงาน เรามีการออมเพิ่มเติม เช่น
  1. กองทุนรวม SSF, RMF
  2. ประกันชีวิตแบบออมทรัพย์
  3. ประกันชีวิตแบบบำนาญ
  4. หุ้น อสังหาริมทรัพย์
  5. กองทุนสำรองเลี้ยงชีพ Provident Fund


28 เมษายน 2563

gitlab public IP range

These are the list of public IP addresses of gitlab, gitlab ci, gitlab runner, gitlab webhook.

184.22.242.115
8.34.208.0/20
8.35.192.0/21
8.35.200.0/23
108.59.80.0/20
108.170.192.0/20
108.170.208.0/21
162.216.148.0/22
23.236.48.0/20
199.223.236.0/23
199.223.232.0/22
199.192.112.0/22
192.158.28.0/22
162.222.176.0/21
173.255.112.0/20
130.211.8.0/21
35.203.240.0/20
35.203.192.0/19
35.203.128.0/18
35.203.0.0/17
23.251.128.0/19
146.148.64.0/18
146.148.32.0/19
146.148.16.0/20
146.148.8.0/21
146.148.4.0/22
146.148.2.0/23
107.178.192.0/18
107.167.160.0/19
35.208.0.0/13
35.204.0.0/14
40.79.75.98
13.68.20.218
40.84.58.110
40.84.59.249
13.68.21.26
40.84.62.218
40.84.58.172
40.84.0.225
40.84.6.191
40.84.3.129
40.84.31.149
104.208.241.47
130.211.16.0/20
130.211.32.0/19
130.211.64.0/18
104.208.242.23
130.211.128.0/17
104.208.241.215
58.221.55.205
192.241.155.107
104.154.0.0/15
67.205.157.233
104.210.2.228
35.235.216.0/21
35.200.0.0/15
35.199.128.0/18
35.199.0.0/17
35.198.0.0/16
35.196.0.0/15
35.192.0.0/14
35.235.224.0/20
35.190.192.0/19
35.190.128.0/18
35.190.0.0/17
35.216.0.0/15
35.188.0.0/15
35.184.0.0/14
104.196.0.0/14
208.68.108.0/23
35.128.0.0/9
198.211.96.0/19
167.99.0.0/16
165.227.0.0/16
162.243.160.0/20
159.89.0.0/16
67.207.80.0/20
35.240.0.0/13
35.224.0.0/12
35.208.0.0/12
35.192.0.0/12
35.184.0.0/13
35.229.73.26
35.229.57.66
35.227.30.36
35.227.29.7
35.196.84.160
35.196.52.77
35.196.49.122
35.196.157.59
35.190.135.156
198.211.104.29
167.99.4.32
167.99.14.148
167.99.1.123
104.196.13.25
52.184.198.203
52.184.196.138
52.184.195.57
52.184.195.32
52.184.195.9
52.184.194.155
52.184.189.123
40.79.45.48
40.79.46.26
40.79.46.123
40.84.62.244
40.84.63.177
40.79.42.83

from https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/434