qbb :: Bash script for setting screen backlight brightness from command line

A quick useful shell script for setting screen backlight brightness from command line. Updates on my github: https://github.com/xdth/qbb/blob/master/qbb

#!/bin/bash
# ##########################################################################################
# #### Description
#
# Adjusts screen backlight brightness from command line. It takes as argument a percentage
# and calculates the final value, based on the maximum brightness of the monitor.
#
# Usage:
# qbb [percentage]
#
# Example for setting brightness to 50%:
# qbb 50
#
# Author: dth@dthlabs.com
# Date: July 9, 2019.
#
# ##########################################################################################
# #### Settings

# Full path of the 'max_brightness' file, containing the maximum brightness of the monitor
max_brightness_path="/sys/class/backlight/intel_backlight/max_brightness"

# Full path of the 'brightness' file, containing the current brightness of the monitor
current_brightness="/sys/class/backlight/intel_backlight/brightness"

# ##########################################################################################
# #### Main

# Get the argument
desired_brightness=$1

# Get the maximum brightness and put into a variable
max_brightness=$(cat "$max_brightness_path")     

# Calculate the final value
final_value=$(($max_brightness * $desired_brightness / 100))

# Set the final value
echo $final_value > $current_brightness

# Return message
echo 'Setting the backlog value to' $final_value '('$desired_brightness'%' of $max_brightness')'

Installing GitLab on Debian 9 with SSL and custom apache vhost

Before you start

First you need to make sure that:
– Your LAMP is up and running
– You have a working DNS for the domain you want to use for gitlab
– You have certbot already installed

Part I – gitlab

Prepare the system for the gitlab install

apt-get update && apt-get upgrade

Install dependencies. Choose “internet site” and press enter.

apt-get install -y curl openssh-server ca-certificates postfix

Add the gitlab repositories

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash

Read more “Installing GitLab on Debian 9 with SSL and custom apache vhost”

Auto mount second HD on boot

The new HD you got online finally arrived. After you open your computer and install it (and after looking for badblocks), you’ll need to mount it automatically on boot.

Type lsblk or mount to find the device (or dmesg if you’re brave). In my case, it was /dev/sdb1

/dev/sdb1 on /media/dth/HD2 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)

Now get the device’s UUID and type with blkid

/dev/sdb1: LABEL="HD2" UUID="0d256b26-1782-4f3f-b192-468464DjhdS7" TYPE="ext4" PARTUUID="290cdbb5-01"

Read more “Auto mount second HD on boot”