Table of contents

Recurring commands

%3 cluster_5356b564_e99d_451c_a410_10c7074b8200 Recurring commands cluster_4290b15a_e388_455d_8163_477c74888b5e Get certificate data from domain cluster_96b52075_e9cc_4ffe_bb63_d8fc877291a9 Copy command output to clipboard _63c23115_8fbf_42b1_8f94_eee55006a01a Get certificate expiration date _34e7051a_5385_41d0_85c9_907d2c8d7a86 Get program progress reading a file _3149bce3_10ea_40af_bc78_d9ebc2eac25a X11 _f92789e5_1324_46a2_865c_1d0fc2c76c81 Wayland _7dac7e56_5509_4f01_9431_51c3140599f5 Check webcam funcionality _6ff44843_6cd9_4697_af31_4c68f432a817 Bridge two TCP ports _d0a5f394_18f5_42a5_8f4d_c6c6a2a31650 Configure default browser _11380731_d635_4a0f_8d4b_6ea94576c5db bash _ea48ec1d_f9d4_4fb7_b39a_faa7b6e2ba95 Notes index _ea48ec1d_f9d4_4fb7_b39a_faa7b6e2ba95->__0:cluster_5356b564_e99d_451c_a410_10c7074b8200 __1:cluster_5356b564_e99d_451c_a410_10c7074b8200->_11380731_d635_4a0f_8d4b_6ea94576c5db

Bridge two TCP ports

Connect local port 9999 to 22 on More documentation

socat tcp-listen:9999,reuseaddr,fork tcp-connect:

Copy command output to clipboard


$COMMAND | xclip -in -sel clip


$COMMAND | wl-copy

Get certificate data from domain
openssl s_client -connect $DOMAIN:443 </dev/null

Get certificate expiration date
openssl s_client -connect $DOMAIN:443 </dev/null 2>/dev/null | openssl x509 -noout -dates

Get program progress reading a file

  • On post

    Leer el progreso de lectura de un archivo

#!/usr/bin/env bash

# Check that we have at least a PID
if [ -z "$1" ];then
   echo "$0 <PID> [<FD>]"
   exit 1

set -eu  # Bail on any error
FD=${2:-} # Take FD if we have second parameter, else consider it empty

if [ -z "$FD" ];then
   # Show the user the available file descriptors
   echo "Select a file descriptor:"
   for i in /proc/$PID/fd/*;do
       printf "  %s: " $(basename $i)
       readlink $i

   read -p "FD: " FD

FSIZE=$(stat -L /proc/$PID/fd/$FD --printf=%s)  # Read full file size
while [ 1 ];do

      # Stop if the process has finished reading the file
      if [ ! -f /proc/$PID/fdinfo/$FD ];then

      # Read position on file
      x=$(cat "/proc/$PID/fdinfo/$FD"|grep pos: |cut -d: -f2|tr -d '\t ')

      # Convert that position into a % of the file size
      PER10000=$(( $x * 10000 / $FSIZE ))
      if [ $PER10000 -le 100 ];then
         # Less than 1%
         printf "  0.%02i%%\n" $(( $PER10000 ));
         # More than 1%
         printf "%3i.%02i%%\n" $(( $PER10000 / 100 )) $(( $PER10000 % 100 ));

      # Wait for the next loop
      sleep 1

Check webcam funcionality

ls -ltr /dev/video*
  • See webcam

mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 30

Configure default browser

## Old style
# sudo update-alternatives  --config x-www-browser

## New style
xdg-settings set default-web-browser <desktop file inside ~/.local/share/applications/>