kubuntu bash : Screenshot capture from command line plus upload and get the link on klipper


For this article you will need  klipper awk  imagemagick  so

sudo apt-get install gawk imagemagick

you have to test if klipper is running or not  , yes you have it but probably it is not running , well to test it just do this :

qdbus org.kde.klipper /klipper org.kde.klipper.klipper.setClipboardContents SILLY_TEXT

now if you do paste you should get SILLY_TEST if so you are running klipper

Get a screenshot from command line :

a=/tmp/screenshot.jpeg
sleep 5
import -window root -crop 1920x1080+0+100 "$a"

this command line can be easier but i will explain the complex one first :

  • a it’s the name
  • sleep 5 , well it actually wait for 5 seconds
  • and now import it’s an imagemagick tool that let you to get a screenshot

now you can see -crop thing that i am using basically to crop automatically the picture because i have 2 monitor so i will get 1920×1080 which it’s the left screen and of course i will erase the top bar of the screen keeping the 1080 resolution

now we got the silly screenshot we have to

UPLOAD THE FILE ON IMAGEBIN.CA

well you have to register on the website  after that you can get  your key , go in your profile Lansharefiles_20181219_120231.jpeg

now we can create our script

curl -s -F key="YOURSILLYKEY" \
     -F file="@$1" \
     https://imagebin.ca/upload.php | awk -F':' '/url:/{gsub(/url:/,"") ; print $0 }'

 

  • the curl -s -F key=”YOURSILLYKEY”  which you have to edit adding your key just send the file on imagebin.ca ,
  • the awk stuff instead filter the shit curl prints just to have the link

SENT THE LINK TO KLIPPER :

 

qdbus org.kde.klipper /klipper org.kde.klipper.klipper.setClipboardContents "$(curl -s -F key="YOURKEY" \
-F file="@$1" \
https://imagebin.ca/upload.php | awk -F':' '/url:/{gsub(/url:/,"") ; print $0 }' )"

 

put all in your  $HOME/.bashrc

This is optional you can add this function to your bashrc and source it to get the function in your bashrc or you can create with the code a executable file and put it on ~/bin or /usr/local/bin which is better that /usr/bin that is a location for standard packages.

 

so

imgup(){

qdbus org.kde.klipper /klipper org.kde.klipper.klipper.setClipboardContents "$(curl -s -F key="yourkey" \
-F file="@$1" \
https://imagebin.ca/upload.php | awk -F':' '/url:/{gsub(/url:/,"") ; print $0 }' )"

## awk -F':' '/url:/{gsub(/url:/,"") ; print $0 }'

}

now you can do source ~/.bashrc and it will do your job just executing : imgup

kubuntu 18.04 connect to wifi using terminal bash konsole


to connect :

  

nmcli device wifi rescan ; nmcli device wifi list 

and you should get something like that

 
IN-USE  SSID  MODE   CHAN  RATE        SIGNAL  BARS  SECURITY 
*       SUPERMAN    Infra  1     195 Mbit/s  37      ▂▄__  WPA2    

so now HERE IT IS:

 nmcli device wifi connect SSID-Name password YOURSILLYLONGPASSWORD

usefull stuff

 nmcli radio
 
WIFI-HW  WIFI     WWAN-HW  WWAN    
enabled  enabled  enabled  enabled 
 
nmcli device
  
DEVICE  TYPE      STATE      CONNECTION 
wlp7s0  wifi      connected  SUPERMAN 2       
enp9s0  ethernet  unmanaged  --         
lo      loopback  unmanaged  --    

Linux kde kubuntu how to check ssd crucial lifetime


Run this , i have sda like dev you could have sdb etc etc

sudo smartctl -a /dev/sda

grepping for crucial : 0x0031

sudo smartctl -a /dev/sda| grep 0031

You should get this

Percent_Lifetime_Used   0x0031   096   096   000    Pre-fail  Offline- 4

means i used 4 % of CRUCIAL LIFETIME