Enable BBR on vps

How to enable?

$ echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
$ echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
# enable the config
$ sysctl -p
# run the command below , if you can see "bbr" in the output , you are success!
$ sysctl net.ipv4.tcp_available_congestion_control
$ sysctl net.ipv4.tcp_congestion_control

Why we use it?

It can lower you tcp network latency and higher you througthput

And more refer:

BBR is a google technology , you can see more in
https://github.com/google/bbr

And you can see more detail in
https://github.com/google/bbr/blob/master/Presentations/bbr-2017-02-08-google-net-research-summit.pdf

When WordPress meet “Access denied for user ‘root’@’localhost'”

In my case , the key is ubuntu mysql default password. When i use “sudo mysql”, will login the mysql without any password or username.

But i use command “sudo mysql_secure_installation” to change the password , it doesn`t work!

After use below command

UPDATE mysql.user
SET authentication_string=PASSWORD(‘your password’),
plugin=’mysql_native_password’
WHERE User=’root’ AND Host=’localhost’;

The error finally solved.

CloudFlare API remark

By default , CloudFlare doesn`t support CNAME record for free plan, instead of NS record.But CNAME is more flexible ! I discover the cloudflare API website and find some APIS can create a CNAME record(but i got an error by create CNAME record)

First , Get you zones id

$ curl -X GET “https://api.cloudflare.com/client/v4/zones” \
-H “X-Auth-Email: [your cloudflare email]” \
-H “X-Auth-Key: [you cloudflare API key]” \
-H “Content-Type: application/json”

Second , Create a CNAME record , But I got an error . I will try to solve it soon.

$ curl -X POST “https://api.cloudflare.com/client/v4/zones/[you zone id get via above request]/custom_hostnames” \
-H “X-Auth-Email: [you cloudflare email]” \
-H “X-Auth-Key: [you cloudflare API key]” \
-H “Content-Type: application/json” \
–data ‘{“hostname”:”[you host like test.abc.com]”,”ssl”:{“method”:”http”,”type”:”dv”,”settings”:{“http2″:”on”,”min_tls_version”:”1.2″,”tls_1_3″:”on”,”ciphers”:[“ECDHE-RSA-AES128-GCM-SHA256″,”AES128-SHA”]}}}’

Run puppeteer in Heroku free node!

$ cd xx # cd in you git repository
$ heroku login -i # login heroku
$ heroku create  # create a free node
$ heroku buildpacks:add --index 1 heroku/nodejs
$ heroku buildpacks:add --index 2 https://github.com/heroku/heroku-buildpack-google-chrome.git
$ git add .
$ git commit -m "init commit"
$ git push heroku master
# push you code to the apps and it will auto build the chrome environment and run you puppeteer code!

# login to the heroku website and start the worker dyno(by default the worker dyno is disable)

Some tips for Puppeteer

1.Type some text into input tags

await page.type('input.form-control[placeholder="Your Email"]',"something you want to input",{delay:500});

the code show above will type “something you want to input” into the <input class=”form-control” placeholder=”Your Email”>

2.Simulate button click

await page.click('input[value="Login"]');

the code show above will click the
<input value=”Login”>

3. Tabs control (Switch foreground and background)

const allPages = await browser.pages(); // get all the tabs in browser
await allPages[1].bringToFront();       
// select 1 and bring it to foreground , notice ! allPages[0] always be a blank page created by puppeteer

4. Simulate keyboard input

await page.keyboard.press('ArrowDown'); 

5. Others

$$ select all the match element and $ just select the first one!


for more detail visit the puppeteer api document!


https://github.com/GoogleChrome/puppeteer/blob/v1.14.0/docs/api.md#pageselector