Skip to content

Instantly share code, notes, and snippets.

View tankibaj's full-sized avatar

Naim tankibaj

  • Berlin, Germany
  • 23:55 (UTC +02:00)
View GitHub Profile

grep + echo should suffice:

grep -qxF 'include "/configs/projectname.conf"' foo.bar || echo 'include "/configs/projectname.conf"' >> foo.bar

Laptop running as a server

I am running an old Dell Laptop as a server with Ubuntu 18.04 on it. Installing Ubuntu on the system was straight forward, but at a certain point you want to close the lid of the laptop. This puts your laptop in sleep, which for a server is not the intended result.

Disable Sleep on Lid Close

Debians Suspend Wiki page had the right solution for this

IP ADDRESS :

ip addr show |grep -w inet |grep -v 127.0.0.1|awk '{ print $2}'| cut -d "/" -f 1
Output : 192.168.16.30
echo "mysql-server mysql-server/root_password password pwd" | sudo debconf-set-selections
echo "mysql-server mysql-server/root_password_again password pwd" | sudo debconf-set-selections
sudo apt-get -y install mysql-server

Attach USB to System

Insert a USB drive into your system and identify your USB drive correctly. This is the step you need to take care, because you may format the wrong disk if not correctly identify your disk.

lsblk

Output:

Attach USB to System

Insert a USB drive into your system and identify your USB drive correctly. This is the step you need to take care, because you may format the wrong disk if not correctly identify your disk.

lsblk

Output: