Blog of science and life

Contact
Archives
Feed

Articles by Do Anh Tu

Freeup your diskspace with "dua"


This evening I want to freeup my diskspace, since 50 GB left (1/10 of my diskspace) is a warning.

Before that I've tried with du and sort but it's so slow and hard to use.

Then I found dua (Disk Usage Analyzer) tool and it is a god send. So good.

To install, just run this command:

curl -LSfs https://raw.githubusercontent.com/Byron/dua-cli/master/ci/install.sh | \
    sh -s -- --git Byron/dua-cli --target x86_64-unknown-linux-musl --crate dua --tag v2.17.4

then dua any directory you want (with /* after path).

For example: dua ~/.cache/* and dua ~/.local/* may supprise you like it does to me.

Try and find out. Good luck.

Read more

Pywright - Render javascript websites


Demo: pywright.fly.dev

What is Playwright?

Playwright is a browser automation library from Microsoft. It can be used to automate tasks in the browser, for testing purpose.

But we can use it to scrape data from websites that use javascript to render the content.

Think about Facebook, Twitter, Instagram, etc. They use javascript to render the content. So we can't scrape them with normal tools like requests or scrapy.

Selenium is a popular tool for scraping javascript websites. It's powerful, have a lot of features, but it's slow and hard to use.

Playwright is a newplayer in this field. It's fast, have excelent simple API.

What is Pywright?

Pywright is a API service writen in python that use Playwright to render javascript websites. You can easily deploy it to any cloud provider then use it as a service.

Install Pywright

I've created a docker image for Playwright. It's contain …

Read more

Deploy "The Lounge" on Fly.io


What is "The Lounge"?

"The Lounge" is a self-hosted web IRC client. It's a fork of Shout, which is no longer maintained. The Lounge is actively maintained and has a lot of features.

Screen shot:

The Lounge

Website:

https://thelounge.chat/

Deploy on Fly.io

Follow these steps to deploy "The Lounge" on Fly.io:

1. Create Dockerfile

FROM thelounge/thelounge:latest

EXPOSE 9000

2. Create new Fly.io app

Run fly launch and follow the instruction. You can choose any name and server region you want.

Or you can copy this fly.toml file (replace <app-name> with your app name):

# fly.toml file generated for iirc on 2022-11-17T21:46:27+07:00

app = "<app-name>"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[mounts]
source="ircdata"
destination="/var/opt/thelounge"

[[services]]
  http_checks = []
  internal_port = 9000
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https …
Read more

« Page 2 / 11 »