Added date information to end of chertex.sh output.
							parent
							
								
									95164fa0a3
								
							
						
					
					
						commit
						59e38ea466
					
				| @ -0,0 +1,12 @@ | ||||
| #!/bin/bash | ||||
| ## Start Chrome with multiple tabs (Gmail, RTM, etc.) | ||||
| ## Written Oct 12, 2013 | ||||
| ## Taha Ahmed | ||||
| 
 | ||||
| a="https://mail.google.com" | ||||
| b="https://rememberthemilk.com" | ||||
| c="https://chepec.timetask.com" | ||||
| 
 | ||||
| google-chrome $a $b $c | ||||
| 
 | ||||
| exit 1 | ||||
| @ -0,0 +1,33 @@ | ||||
| #!/bin/bash | ||||
| ## Convert PDF to text and send to Pocket | ||||
| ## Written Nov 24, 2013 | ||||
| ## Taha Ahmed | ||||
| 
 | ||||
| # Usage: | ||||
| # pdf2pocket.sh worthreading.pdf | ||||
| # Note: requires python and the python script "sendfromgmail.py" | ||||
| 
 | ||||
| 
 | ||||
| pdffile=$1 | ||||
| # Filename without extension part | ||||
| jobname=${pdffile%.*}  | ||||
| txtfile=$jobname.txt | ||||
| htmlfile=$jobname.html | ||||
| 
 | ||||
| 
 | ||||
| # convert PDF to txt (saved in the current directory) | ||||
| # it seems txt works better than HTML (Pocket cannot reformat HTML files for reasons unknown to me...) | ||||
| pdftotext $pdffile | ||||
| 
 | ||||
| 
 | ||||
| # copy the created file to my Dropbox public folder | ||||
| cp $txtfile /home/taha/Dropbox/Public/$txtfile | ||||
| 
 | ||||
| 
 | ||||
| # construct the corresponding Dropbox public URL | ||||
| htmlurl="https://dl.dropboxusercontent.com/u/47462551/$txtfile" | ||||
| 
 | ||||
| 
 | ||||
| # email url of htmlfile in public Dropbox to Pocket | ||||
| python ~/chepec/chetex/common/bash/sendfromgmail.py "add@getpocket.com" "dropbox2pocket" "$htmlurl" | ||||
| 
 | ||||
| @ -0,0 +1,30 @@ | ||||
| #!/bin/bash | ||||
| ## Convert PDF to text and send to Readability | ||||
| ## Written Nov 6, 2013 | ||||
| ## Taha Ahmed | ||||
| 
 | ||||
| 
 | ||||
| pdffile=$1 | ||||
| # Filename without extension part | ||||
| jobname=${pdffile%.*}  | ||||
| txtfile=$jobname.txt | ||||
| htmlfile=$jobname.html | ||||
| #outfile=$jobname | ||||
| 
 | ||||
| # saves a HTML file in the current directory | ||||
| pdftotext -htmlmeta $pdffile | ||||
| 
 | ||||
| # remove newlines from txtfile | ||||
| #tr -d "\n" < $txtfile >  | ||||
| 
 | ||||
| # copy the created txtfile to dropbox public folder | ||||
| # and rename it to *.HTML | ||||
| cp $htmlfile /home/taha/Dropbox/Public/$htmlfile | ||||
| 
 | ||||
| # construct the corresponding Dropbox public URL | ||||
| htmlurl="https://dl.dropboxusercontent.com/u/47462551/$htmlfile" | ||||
| 
 | ||||
| # email url of htmlfile on dropbox to readability | ||||
| #mail -s "dropbox2readability" chepec+simms@inbox.readability.com <<< $txturl | ||||
| mail -t "chepec+simms@inbox.readability.com" -s "dropbox2readability" <<< $htmlurl | ||||
| 
 | ||||
| @ -0,0 +1,66 @@ | ||||
| #!/usr/bin/python | ||||
| import os, re | ||||
| import sys | ||||
| import smtplib | ||||
| 
 | ||||
| # I have commented out the parts that allow sending of attachments... | ||||
| # I got this code from user hakermania at http://ubuntuforums.org/showthread.php?t=1472520 | ||||
|   | ||||
| #from email.mime.image import MIMEImage | ||||
| from email import encoders | ||||
| from email.mime.multipart import MIMEMultipart | ||||
| from email.mime.base import MIMEBase | ||||
| from email.MIMEText import MIMEText | ||||
| 
 | ||||
|   | ||||
| SMTP_SERVER = 'smtp.gmail.com' | ||||
| SMTP_PORT = 587 | ||||
| 
 | ||||
|   | ||||
| sender = 'taha.sol@gmail.com' | ||||
| password = "OKWS:pled2XO" | ||||
| recipient = sys.argv[1] | ||||
| subject = '' | ||||
| message = sys.argv[3] | ||||
|   | ||||
| def main(): | ||||
|     msg = MIMEMultipart() | ||||
|     msg['Subject'] = sys.argv[2] | ||||
|     msg['To'] = recipient | ||||
|     msg['From'] = sender | ||||
|      | ||||
|      | ||||
|     part = MIMEText('text', "plain") | ||||
|     part.set_payload(message) | ||||
|     msg.attach(part) | ||||
|      | ||||
|     session = smtplib.SMTP(SMTP_SERVER, SMTP_PORT) | ||||
|   | ||||
|     session.ehlo() | ||||
|     session.starttls() | ||||
|     session.ehlo | ||||
|      | ||||
|     session.login(sender, password) | ||||
| 
 | ||||
|     #fp = open(sys.argv[4], 'rb') | ||||
|     #msgq = MIMEBase('audio', 'audio') | ||||
|     #msgq.set_payload(fp.read()) | ||||
|     #fp.close() | ||||
|     # Encode the payload using Base64 | ||||
|     #encoders.encode_base64(msgq) | ||||
|     # Set the filename parameter | ||||
|     #filename=sys.argv[4] | ||||
|     #msgq.add_header('Content-Disposition', 'attachment', filename=filename) | ||||
|     #msg.attach(msgq) | ||||
|     # Now send or store the message | ||||
|     qwertyuiop = msg.as_string() | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     session.sendmail(sender, recipient, qwertyuiop) | ||||
|      | ||||
|     session.quit() | ||||
|     os.system('notify-send "Email sent"') | ||||
|   | ||||
| if __name__ == '__main__': | ||||
|     main() | ||||
					Loading…
					
					
				
		Reference in New Issue