Sunday, March 29, 2020

linux: set sudo powers to a specific user

Add the username into wheel group via /etc/group

vi /etc/group
wheel:x:10:YOUR_USER_NAME

$ sudo my-command

Thursday, March 26, 2020

Fedora: build: gcc/cc - /usr/bin/ld: cannot find -lc

cc -std=c99 -Os -Wall -Werror -Wextra -static -c -o pinns.o pinns.c
cc -o ../bin/pinns pinns.o -std=c99 -Os -Wall -Werror -Wextra -static
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:11: ../bin/pinns] Error 1
make[1]: Leaving directory '/home/douglas/cri-o/pinns'
make: *** [Makefile:143: bin/pinns] Error 2

Solve:
$ sudo dnf install glibc-static -y

Tuesday, March 24, 2020

golang: go get - download project and it's dep.

Get downloads the packages named by the import paths, along with their dependencies. It then installs the named packages, like 'go install'.

$ go get -d -u github.com/user/projectname (DO NOT USE http:// or https://)

The -d flag instructs get to stop after downloading the packages; that is, it instructs get not to install the packages.

The -u flag instructs get to use the network to update the named packages and their dependencies. By default, get uses the network to check out missing packages but does not use it to look for updates to existing packages.

The -v flag enables verbose progress and debug output.

golang: Playing online with go

Use: play.golang.com

Sunday, March 22, 2020

Linux: merge pdf files

$ sudo dnf install poppler-utils
$ pdfunite file01.pdf file02.pdf merged_file.pdf

Monday, March 16, 2020

git: How to update my fork in github ?

# Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:

git fetch upstream

# Make sure that you're on your master branch:

git checkout master

# Rewrite your master branch so that any commits of yours that
# aren't already in upstream/master are replayed on top of that
# other branch:

git rebase upstream/master

Reference: https://stackoverflow.com/questions/7244321/how-do-i-update-a-github-forked-repository

Sunday, March 15, 2020

3D: Unifi/Ubiquiti support for cameras

Download: https://www.thingiverse.com/thing:3180368

dnf automatic updates

A service to automatically download and install any new updates (for example security updates).

# dnf install dnf-automatic

# systemctl enable --now dnf-automatic-install.timer

# vi /etc/dnf/automatic.conf (Adjust the best settings for your environment)
apply_updates = yes

More info: https://fedoraproject.org/wiki/AutoUpdates

Tuesday, March 3, 2020

bash: check if file exists

FILE="/etc/resolv.conf"
if [[ -f "${FILE}" ]]; then
   echo "${FILE} exist"
fi