-->

2021/01/29

讓 rsync 顯示進度指示

 問了男人以後,發現其中地方有一個沒注意到:

--progress              show progress during transfer


原來 rsyc 也可以顯示大致上的進度。



2021/01/28

Docker on Windows 10 鳥鳥的

Docker client 的是窗是長這樣:



如果要進 images 就更麻煩了,沒有好的 shell 可以用:


好險只打算用一次做 dirty work ....

2021/01/18

快速複製 table 資料 - insert into select

遇到一個奇怪的需求,要備份特定資料表的資料。因為很懶所以直接從 SQL 動手。

用 show create table 複製原有資料表的 schema:

> show create table users \G                                                                                         
***************************[ 1. row ]***************************
Table        | users
Create Table | CREATE TABLE `users` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(100) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_name` (`name`),
  KEY `idx_email` (`email`)
) ENGINE=InnoDB


再來用 「insert into select」 的方法來從原有的資料表拉資料:

insert into backup (name, email)
select name, email from users where id in (1, 3, 5)


這個作法好像會比一次一筆資料拉還要快一些,不過要注意的是 id (或是 auto_increment) 等欄位要忽略,讓 DB 自己處理,不然之後新增資料可能會出現 duplicated keys 之類的問題。

2021/01/16

Lutris 在 Ubuntu 20.04 上啟動失敗

 Lutris 0.5.8 在 Ubuntu 20.04 上啟動時會自動中斷,在 console 底下看到錯誤訊息:

Traceback (most recent call last):
  File "/usr/games/lutris", line 54, in 
    from lutris.gui.application import Application  # pylint: disable=no-name-in-module
  File "/usr/lib/python3/dist-packages/lutris/gui/application.py", line 53, in 
    from .lutriswindow import LutrisWindow
  File "/usr/lib/python3/dist-packages/lutris/gui/lutriswindow.py", line 26, in
    from lutris.gui.widgets.sidebar import LutrisSidebar
  File "/usr/lib/python3/dist-packages/lutris/gui/widgets/sidebar.py", line 6, in
    from lutris import platforms, runners, services
  File "/usr/lib/python3/dist-packages/lutris/platforms.py", line 19, in 
    _init_platforms()
  File "/usr/lib/python3/dist-packages/lutris/platforms.py", line 14, in _init_platforms
    runner = runners.import_runner(runner_name)()
  File "/usr/lib/python3/dist-packages/lutris/runners/wine.py", line 229, in __init__
    "default": dxvk.DXVKManager().version,
  File "/usr/lib/python3/dist-packages/lutris/util/wine/dxvk.py", line 56, in version
    return self.versions[0]
  File "/usr/lib/python3/dist-packages/lutris/util/wine/dxvk.py", line 45, in versions
    self._versions = self.load_dxvk_versions()
  File "/usr/lib/python3/dist-packages/lutris/util/wine/dxvk.py", line 65, in load_dxvk_versions
    with open(versions_path, "r") as dxvk_version_file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/zeroplex/.local/share/lutris/runtime/dxvk/dxvk_versions.json


在 reddit 上面看到有人遇到同樣情況,似乎把設定檔塞到正確位置即可:

$ mkdir -p /home/zeroplex/.local/share/lutris/runtime/dxvk/
$ wget https://cdn.discordapp.com/attachments/538903130704838656/796102070825779250/dxvk_versions.json
$ mv dxvk_versions.json /home/zeroplex/.local/share/lutris/runtime/dxvk/