Wednesday, October 18, 2023

Debian 12 - sudo vim /etc/apt/sources.list

deb     http://deb.debian.org/debian/ bookworm 				main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm 				main contrib non-free non-free-firmware

deb     http://deb.debian.org/debian/ bookworm-updates 			main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-updates 			main contrib non-free non-free-firmware

deb     http://security.debian.org/debian-security/ bookworm-security 	main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security/ bookworm-security 	main contrib non-free non-free-firmware

deb     http://deb.debian.org/debian/ bookworm-backports 		main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-backports 		main contrib non-free non-free-firmware

Tuesday, June 20, 2023

Javascript async defer

Both async and defer have one common thing: downloading of such scripts doesn’t block page rendering. So the user can read page content and get acquainted with the page immediately.

But there are also essential differences between them:

OrderDOMContentLoaded
asyncLoad-first order.
Their document order doesn’t matter which loads first runs first
Irrelevant.
May load and execute while the document has not yet been fully downloaded.
That happens if scripts are small or cached, and the document is long enough.
deferDocument order (as they go in the document).Execute after the document is loaded and parsed (they wait if needed), right before DOMContentLoaded.

In practice, defer is used for scripts that need the whole DOM and/or their relative execution order is important.

And async is used for independent scripts, like counters or ads. And their relative execution order does not matter.

Page without scripts should be usable

Please note: if you’re using defer or async, then user will see the page before the script loads.

In such case, some graphical components are probably not initialized yet.

Don’t forget to put “loading” indication and disable buttons that aren’t functional yet. Let the user clearly see what he can do on the page, and what’s still getting ready.

Thursday, October 13, 2022

How to use `not` condition in the gitlab api issue query

From Gitlab issues api documentation, not is of type Hash. It's a special type documented here

For example to exclude the labels Category:DAST and devops::secure, and to exclude the milestone 13.11, you would use the following parameters:

not[labels]=Category:DAST,devops::secure
not[milestone]=13.11

api example: https://gitlab.com/api/v4/issues?scope=all&state=opened&assignee_username=derekferguson&not[labels]=Category:DAST,devops::secure&not[milestone]=13.11

Using gitlab python module, you would need to pass some extra parameters by adding more keyword arguments:

import gitlab

gl = gitlab.Gitlab('https://gitlab.com')

extra_params = {
    'not[labels]': "Category:DAST,devops::secure",
    "not[milestone]": "13.11"
}
issues = gl.issues.list(all=True, scope='all', state='opened',
                        assignee_username='derekferguson', **extra_params)
for issue in issues:
    print(issue.title)

Wednesday, September 21, 2022

Debian 11 - sudo subl /etc/apt/sources.list

deb http://deb.debian.org/debian bullseye main contrib non-free
deb-src http://deb.debian.org/debian bullseye main contrib non-free

deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free

deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free

deb http://deb.debian.org/debian bullseye-backports main contrib non-free
deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free

Sunday, June 12, 2022

Ubuntu Minimal 22.04 LTS (TODO)

Install Ubuntu Server (minimized)
sudo apt purge -y snapd
sudo apt purge -y apparmor
sudo apt update;
sudo apt install xubuntu-core^;
sudo apt purge -y snapd 
sudo apt purge -y gnome-software-plugin-snap

sudo apt purge -y apparmor
sudo apt purge -y cups*
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

systemd-timesyncd

sudo apt update && sudo apt install systemd-timesyncd && sudo systemctl enable --now systemd-timesyncd