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

Saturday, June 11, 2022

Monday, February 07, 2022

How to find total filesize grouped by extension

find . -name '*' -type f -printf '%b.%f\0' | awk -F . -v RS='\0' '{if (NF==2) $(NF+1)=" "; s[$NF] += $1; n[$NF]++} END {for (e in s) printf "%15d %6d  %s\n", s[e]*512, n[e], e}' | sort -rn | numfmt --to=iec-i --suffix=B

How can I recursively delete all files of a specific extension in the current directory?

You don't even need to use rm in this case if you are afraid. Use find:

find . -name "*.bak" -type f -delete
But use it with precaution. Run first:

find . -name "*.bak" -type f
to see exactly which files you will remove.

Sunday, February 06, 2022

Unzip All Files In A Directory

This works in bash, according to this link:

unzip \*.zip


or 


Just put in some quotes to escape the wildcard:

unzip "*.zip"

Saturday, January 22, 2022

Ubuntu – Increase number of old kernels to keep on autoremove

So I looked into the script a little bit and some minor changes was enough to get what you want.

First create a backup of: /etc/kernel/postinst.d/apt-auto-removal:

sudo cp /etc/kernel/postinst.d/apt-auto-removal{,.bk}

Then find this line:

previous_version="$(echo "$debverlist" | sed -n 2p)"

and change it to:

previous_version="$(echo "$debverlist" | sed -n 2,4p)"
  • Now it should keep 3 old kernel + Running + Newly installed one
  • Of course you have to run it once manually or install a new kernel to make it take effect.

How to revert comments Youtube layout?

#see video for details  https://www.youtube.com/watch?v=J0L_nYtNlqs #uBlock Origin  https://chrome.google.com/webstore/detail/ublock-o...