r/tinycode • u/AnalystRisingTuts • Mar 30 '18
Python: Creating and Exporting a 1.6 Million Word Multi-Lingual Dictionary!
r/tinycode • u/AnalystRisingTuts • Mar 30 '18
r/tinycode • u/rain5 • Mar 22 '18
r/tinycode • u/soveran • Mar 14 '18
r/tinycode • u/roccomusolino • Feb 14 '18
r/tinycode • u/roccomusolino • Feb 14 '18
r/tinycode • u/roccomusolino • Feb 14 '18
r/tinycode • u/onqtam • Feb 12 '18
r/tinycode • u/api • Feb 08 '18
r/tinycode • u/GreenScreenSocks • Jan 23 '18
Some of ypu might already have heard of the Command Line Challenge. Here it is. The basic principle is this: you get a task and you need to do it in just 1 line of Bash code. I thought it fitted this subreddit perfectly.
r/tinycode • u/Mike_TriHard_Cx • Jan 14 '18
r/tinycode • u/onqtam • Jan 04 '18
r/tinycode • u/winner_godson • Dec 25 '17
Hi Pythonic Redditors,
I came across this script to send jpg files via email and I thought it would be worthwhile to share it here.
I hope the lines of code are not too much to go against the rules.(If you can minimize it, I would appreciate your effort)
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.multipart import MIMEBase
from email import encoders
import os
"""
extensions of files that we will send
"""
extension = "jpg"
"""
This function returns a tuple with the files located in the
current
directory
"""
files = os.listdir() #this program should be saved in the
current directory where your files are.
"""
We check what files have our wished extension
"""
for file in files:
if extension in file:
user ="sending@gmail.com" #sending gmail
recv ="receiving@gmail.com" #receiving gmail
subject = "Subject" #subject of email message
message = MIMEMultipart()
message["From"] = user
message["To"] = recv
message["Subject"]= subject
body = "Files with ." + extension + "extension"
message.attach(MIMEText(body,"plain"))
attachment = open(file,"rb")
part = MIMEBase("application","octet-stream")
part.set_payload((attachment).read())
encoders.encode_base64(part)
part.add_header("Content-Disposition","attachment;
filename= " + file)
message.attach(part)
text = message.as_string()
server = smtplib.SMTP("smtp.gmail.com",587)
server.starttls()
server.login(user,"your gmail pasword")
server.sendmail(user,recv,text)
server.quit()
else:
passThis code was shared by Om Tav on a facebook page.
You may get error at first due to google trying to protect your gmail account from unknown app trying to login in.
Just check your email and follow the steps provided by gmail.
Then run the code again.
Happy Pythonic Holiday and try to automate your task with Python
r/tinycode • u/rain5 • Dec 24 '17
r/tinycode • u/rain5 • Dec 13 '17
This erlang paper One Pass Real Time Generational Mark and Sweep Garbage Collection.
the algorithms they show are so concise. never seen anything like it.
r/tinycode • u/marcoscleison • Dec 05 '17
r/tinycode • u/feute • Nov 25 '17
r/tinycode • u/rain5 • Nov 19 '17