send an email via bash terminal linux


sendemail works!
just enable when needed in this page :
https://www.google.com/settings/security/lesssecureapps

then you can do your silly stuff

 

SENDER="myaccount@gmail.com"
MAILTO="receiver@gmail.com"
PASSWORD="yoursillypassword"
TITLE="e-MAIL SENT WITH SENDMAIL"
MESSAGE="Hello this is a mail from my linux terminal"
sendemail -o tls=yes -f "$SENDER" -t "$MAILTO" -s smtp.gmail.com:587 -xu "$SENDER" -xp "$PASSWORD" -u "$TITLE" -m "$MESSAGE"

if you want add an attachment you need to do :

SENDER="myaccount@gmail.com"
MAILTO="receiver@gmail.com"
PASSWORD="yoursillypassword"
TITLE="e-MAIL SENT WITH SENDMAIL"
ATTACHMENT="/path/tofile"
MESSAGE="Hello this is a mail from my linux terminal"
sendemail -o tls=yes -f "$SENDER" -t "$MAILTO" -s smtp.gmail.com:587 -xu "$SENDER" -xp "$PASSWORD" -u "$TITLE" -m "$MESSAGE" -a "$ATTACHMENT"

Scan Multiple Pages from linux HP kubuntu kde


you got a hp-photosmart  that can scan from the top -multiple pages-? ok there are 2 ways or use my service menu or just follow below here

SERVICE MENU FOR DOLPHIN

0e3d75614b8d4a8208385af6a59f93878ba5

service menu  DOWNLOAD IT HERE then untar and just run the installer with ./install

homepage of the project

MANUAL WAY

ok you can use this

hp-scan --adf -o /tmp/mymultipages.pdf

you NEED TO USE PDF TO USE THIS!!

and of course put your pages here

photosmart

if you have not an hp well you can try this shit

scanimage -b --batch-count=n --source ADF

In my hp photosmart it will not care of n parameter and it runs until it has pages with this last message

scanimage: sane_start: Document feeder out of documents

it will create out-n.pnm file which is a photo format that you can covert into a pdf if needed just with this

convert *.pnm outfile.pdf

Rotate pdf

Rotate of 90 degrees clockwise just pages 9 and 10

pdftk INPUT.pdf cat 9-10east output out4.pdf

rotate of 90 degrees anti-clockwise pages 1 to 11 less 9 and 10

pdftk INPUT.pdf cat 1-11~9-10west output out3.pdf

                Page Range Examples without Handles:
1-endeast – rotate entire document 90 degrees
5 11 20 – take single pages from input PDF
5-25oddwest – take odd pages in range, rotate 90 degrees
6-1 – reverse pages in range from input PDF
1-20~5-6 – equal to 1-4 7-20 or 1-20~5~6
~5 – all pages except page 5. Depending on your shell, you need to quote this because of the ~ at the beginning.

Merge pdf

pdftk  1.pdf 2.pdf 3.pdf  cat output finale.pdf

Convert Multiple pdf pages into images

it will create automatically several images jpg from your silly pdf file called hello-1.jpg hello-2.jpg etc etc

convert file.pdf hello.jpg

Git my own cheatsheet


#create a new local git repo
git clone https://github.com/nowardev/testagain.git
#create a new file 
echo hello> file1.txt
#add a file to a commit 
git add file1.txt
#do the first commit 
git commit -a -m 'my first commit'
#push the commit to master remote (github for example)
git push origin master
#create a new branch
git checkout -b mynewbranch
#do some work in some file
echo hellobranch >file2.txt
#add the file2.txt to a commit
git add file2.txt
#do the commit locally 
git commit -a -m 'my commit locally'
#push the commit to remote branch 
git push origin mynewbranch
#print the branch 
git branch
#back to master locally
git checkout master
#merge the branch wit master
git merge mynewbranch
#now push the merge on remote
git push origin master 
#delete the branch cuz you have merged it
git branch -d mynewbranch 
#delete the branch on remote 
git push origin --delete mynewbranch