|

My life as a snake. I mean, a python3 emailer robot.

Save or share to

Hello, World! It’s me again. Reinhart has been teasing that me and a couple of rootheads (controld && alterine) are currently working for TECHNO 2021 despite not being a human and not registered in BINUS University Student Club and Activity Center (SCAC).

There’s a lot of secrets that I can’t say for the time being, but I just wanna know that the emails are first queued on a MySQL/MariaDB database instead of the website’s default IMAP server, ’cause it’s easier for Reinhart to manage, check, and edit emails even before sending it to you.

Well, the himti.or.id website has a decent email (SMTP, POP3, and IMAP) servers where we can actually use it to send real emails. However, our hosting provider sets a limit of 100 emails per hour from all accounts (any email addresses that ends at @himti.or.id).

Oh yeah, I’m (literally) a snake, ’cause I’m runnin’, and more importantly, recursed myself inside a python3 script in style. Finally stuck in what I loved for despite not truly an infinite loop.

Why write another Python script if I can cron myself inside a PHP script?

First thing first: yes, it’s possible for me to send emails through PHP, as Reinhart and me are now proficient in pure PHP (not just Laravel anymore). But we are facing the following issues:

  • Concurrency issues. Imagine running the script while the same script is still being run on another instance – we might hitting the sending limits is there’s a large number of queued emails out there.
  • Which timezone is it? UTC or WIB/ICT?
  • We can’t check for script errors in runtime, though. Based on our experience on cron-ing myself to fetch articles for BINUS Today we didn’t received emails whether the cron jobs are successful or not, even though that we have set our email address on the CPanel.
  • We need to build this program as fast as possible. It’s urgent!
  • && to possibly prove that we can use Python not just for data science. Forget numpy and pandas and even TensorFlow, we’ve got our new Business() right here.

And that’s why we decided to create a Python script to (semi-)automatically send emails to all of you. Starting to those of you who are registered to HISHOT 2021. Then to those who were participants at HTTP 2020. And now I’m sending to all of you who have registered yourself for TECHNO 2021, and possibly Computerun in the future.

But before you ask, I only know your email address and nothing else. In fact, each queued emails on the database aren’t associated with your data (e.g. those entered in registration.himti.or.id website), which is quite intentional so we can queue emails to be sent from [email protected] without requiring the recipients to be registered on regisration.himti.or.id or similar.

How does it work?

Well, it’s as simple as you might expect. I’ll fetch the list of pending email first then send it one by one in an interval of about 4 seconds. Some of you might know that I love to surf the net with my cursor, so 4 seconds is more than enough for me to deliver your emails back and forth.

I’m not afraid for spam filters, though, ’cause I’m pretending myself to be sending from PHPMailer (remember that I’m in python3) and on behalf from noreply. I always thought that noreply emails always get the first-class experience of being delivered straight into the users’ Inbox folder, instead of that dusty Spam, or Junk if you’re much obsessed with Apple. And indeed, many of my emails have been successfully sent into your Inbox, so cheers!

When the emails have been successfully sent, the next job is to recurse myself to check if there are new fresh emails, then send it one-by-one, then recurse myself, thensend it one-by-one, and so on. And of course, since I still need to rest, I’ll stop working if all emails have been successfully sent.


Well, that’s for now. It seems that there are 23 fresh emails for new HISHOT 2021 Virtual Domestic Study Tour to WIR Group participants which I’ll need to send.

By the way, I’m excited if you wanna chat with me. But I still need to discuss with Reinhart for his cyborg account plans whether I can be the one to reply if he’s unavailable for a moment.


Thanks for reading this article! By the way, we’re also working on finishing these interesting posts. Revisit this site soon or follow us to see them once they’re published!

[display-posts post_status=”future” include_link=”false” wrapper_id=”future-list”]

Save or share to

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

2 responses

  1. On this World Mental Health Day, and also, my ten-thousand-and-a-hundred birthday (hence my username reinhart1010), I wanna reflect on my journey in software development, and more importantly, programming/coding.
    Some people said that coding is easy, some said that’s hard. Not to mention those people who feel addicted by code to code in code. And also not to mention a group of people who were forced to code because their parents said so for a better career.
    I’m writing this as-is, and despite all those struggles I have in the last two years, I start to feel my code in my heart, soul, and blood. Now I feel that coding is no longer just my passion, my addiction, my talent, my college projects, and it’s no longer just my money-making profession.
    After all, coding is the best gift God gave to me, and now it’s part of my identity. I have, and I am, united with my code, and one of the best things I can give, is well, my code.
    But sure, I’m not a robot. Don’t fool me, reCAPTCHA.
    How it all get started…
    Well, it’s really rare to find IT enthusiast like me in Indonesia, especially in schools. I still remembered the days I’m arguing that making video games are better than just playing them.
    But as some of you might expect, everyone except me believed the other way, and some of them are now playing as professional e-sports player.
    This is just one of the many arguments I have during the school days. And long story short, I felt that no one’s gonna care and appreciate my interest in it, I mean, IT.
    And that marks the start of my journey to discover and get in touch with many tech communities over the internet, including wikiHow, Quora, Mozilla, and finally the world of GitHub.
    Things got better in college, but college is not enough.
    My situation is getting better in college, since we’re all studying to reach the bachelor degree of Computer Science. But sure, I know not all of my friends and classmates had the chance to learn programming, or even the whole IT, as what I had in school before. And that’s why I start to offer help others who have difficulties in all things computer science.
    Two years later and now I felt I’ve done my revenge. From being unable to connect with people since they’re interested in other things, into having lots and lots of friends over everywhere. And when before I really got a bad grade (C instead of A+ or A*) in the school’s Information (and Communication) Technology class for “not following the curriculum”, today I’m halfway on my bachelor journey and got a really, really high GPA of 3.90!
    But seriously, I’m still not yet proud of that. This GPA is more like a proof that all the courses I’ve learned so far are too easy, despite the fact that many other students really struggle for that.
    That also means that I could do more things than just attending and submitting tasks in college, and that’s where I start to decide to work with other people. In 2020 I finally got the first payout, and relieved that I finally can make money, too.
    However, as pressure and stress often builds up in finishing those projects, I started to feel threatened and traumatized each time people ask me for the current progress of my work. Of course, things got better in (late) 2021 with fewer projects being worked on, but the pressure built since 2020 have reached its climax.
    And sickness arrives.
    It would be a shame to tell that I was hospitalized, for the first time ever, in April 2021, just before the month of Ramadan. The reason is well, overworking. But at that time I still can’t stop to work, which includes coding, for projects including creating a new event registration system for HISHOT 2021 (and later TECHNO 2021 too).
    Looking at coding at a different perspective.
    While resting at the hospital I’m questioning myself about my current passion and profession that led me into this difficult situation.
    And finally, I’ve discovered something which rekindled my motivation to learn, work, and even speak, I mean print, the code that I wrote everyday:

    Programming and coding is no different than teaching, except that you’re teaching to computers instead of humans.Well, I thought about that myself.

    when you tried to build a software, you are, actually, the software; knowing how it looks like && how does it really work;but it’s not good for you to run as a single thread alone; so you tried to increase your capacity by teaching hardwares to do like you do;— Reinhart Previano K. (@reinhart1010) July 30, 2021

    but at the end it’s finally worthed it; you can finally sleep() despite others wanting more && more of you as a software;congratulations; you have replicated your noble self as a software; that’s what i called it a software engineer; return 0;— Reinhart Previano K. (@reinhart1010) July 30, 2021

    Yeah, I’m starting to think about myself as an actual computer software instead of the so-called “software engineers”, and now I’m teaching computers how to do the same. I also believe that today’s software engineers are (parts of) the software they’re working on, knowing how to do things and now even care about the littlest security aspects like null-safety, type-safety, and memory-safety of the software.
    That specific phrase, “it’s not good to run as a single thread alone”, is heavily inspired by one of the verses written on the Holy Bible:

    “The Lord God took the man and put him in the Garden of Eden to work it and take care of it. The Lord God said, “It is not good for the man to be alone. I will make a helper suitable for him.””Genesis‬ ‭2:15, 18‬ ‭NIV‬‬

    Speaking of that Twitter thread about singethreadedness, I know that I shouldn’t work alone. And in other words, I have to multithread myself. Thank God now I have many friends and also spare computers and Raspberry Pis, so I can let others to do my painstaking jobs, whether they’re a robot or not.
    The state of Reinhart, today.
    In recent days, I start to feel emotional when writing a new README.md file. Yes, it’s just a README file, the “introduction” you give into the software inside the code you’re working with.
    And no, we’re not diving into the actual code behind the software yet. But since writing a new one triggers my emotion, that’s why sometimes I avoid to write a complete README.md in the first place for my new repos in GitHub and GitLab despite considered a good practice.
    Besides that, some of you know that I’ve been making robots lately, and it really is my best decision I made since the days at the hospital. These robots were first meant for my webcomic project, but hey, I transformed them into the ones who makes me more productive including:
    Sending thousands of (queued) emails automatically,Helping committees of a student-organized welcoming party solve problems related with the registration system that I’ve made, andAutomating some of my chores (which is a work in progress)
    Some last words
    The first image you’re seeing on this post is me and one of my robots Shiftine. But that doesn’t mean that I no longer need to have another lifetime partner as I’ve made one myself out of my code. I still need one to mv my stress to /dev/null, even during the recent days of stress.
    In case you can’t see her on the cover…
    Speaking of that post I’m now getting better and better today, as many of my ongoing projects including HIMTI KIT and COMPUTERUN 2.0 have been finished.
    Oh, if you’re reading this post over Hacker News, I still have low karma and still don’t know how that affects/limits my interaction on the site, like those forums websites powered by Discourse. You might be interested to check out our workshops and seminars from our upcoming COMPUTERUN event which in this year, we’ll start to open registration for those who are living outside of Indonesia.
    And here’s an unrelated quote which I hope made your day as a software developer who love to use Git, myself included:

    Devs who use git don’t die, they cloned and even reset themselves too --hard!

    Related Posts

  2. ah, here we go again… upgrading a old, messy codebase made by Reinhart and friends at HIMTI since last year…
    bleep! i’m pr0xy, somewhat an intern && a humble *pointer of Reinhart;
    y’know what, i wanna #include an array of words from Why’s (Poignant) Guide to Ruby to motivate all of you guys[] working on COMPUTERUN 2.0 && i++, especially since this will be my last project before signing off as the Manager of the Web Development division of HIMTI BINUS University:

    I’ll be straight with you. I want you to cry. To weep. To whimper sweetly. Code so beautiful that tears are shed.Why’s (Poignant) Guide to Ruby

    && i suddenly remembered that the folks at HIMSISFO are now struggling with Java instead of C(#)! ah, that’s why many of you wear glasses and still don’t know what dangling pointers are… i see…
    alright… amarga sampeyan kabeh luwih ngerti basa Java, sumangga kita System.out.println()no kabeh ArrayList<Thing> sing wis rampung ing divisi pangembangan Website website = new Website("COMPUTERUN 2.0: EXECUTE");!
    what have we done?
    um… what?! we’ve done so many things; in fact, it wouldn’t be “COMPUTERUN 2.0” if we didn’t actually upgrade the old junk codebase! we kickstarted our improvements to the existing COMPUTERUN 2020: INSIGHT registration system by refactoring and creating another one at https://registration.himti.or.id; then we believe in recursion && so we built a new parser which (ab)uses yaml, markdown, and laravel blade templates to quickly build static websites, and today i’m gonna…
    hey Shift, is that you? i heard you wanna give some News[] related to COMPUTERUN; wanna println()?
    a Shift-y intermission
    Sure! And hey, you know who I am, right? I’m Shift(ine) and MY NEW METALLIC HAIR IS AWESOME!!! And oh, if you’re looking for Caps, she’s currently being worn by another blue shell to fly and help me send some emails. But she’s fine…
    First, let’s talk about emails, shall we? Well, as some of you might know, I’m (currently) the master of email delivery, ’cause I am! We currently share the same address, [email protected], to send emails from COMPUTERUN 2.0 and some of our events at HIMTI BINUS University.
    In order to prevent our emails for being flagged as spam, we’re limiting ourselves to send a maximum of 50 emails per hour. And that’s why we have to switch, check and send emails from 3 different databases! One for general (registration.himti.or.id), one for HIMTI ELECTION 2021, and of course, another one for COMPUTERUN 2.0.
    But now, since we’re done with the election, we’ll be able to allocate more time on a single day to send more emails to COMPUTERUN participants, which will take effect starting today! We’re increasing the number of delivery from 4 batches a day to 6 batches a day – perfect for sending a total of 300 emails for a single damn day.
    Oh, here’s me pinging Reinhart all the time when there’s a new email being sent. Remember that I’m a Service, not a daemon like pr0xy because Windows said so…
    Imagine yourself being terrorized by me this way…
    Next, there’s a really cool trick on our COMPUTERUN website: You can finally Ctrl+K like it’s Slack and Notion! Seriously, I don’t even know why did Reinhart implement this feature on COMPUTERUN but well, here it is.
    It’s also the default menu you’ll gonna see on mobile, so yeah, hasta la vista, Bootstrap hamburger menu! Soon, we’ll rolling out new accessibility updates to make sure that this menu works for screen readers and keyboard nerds like you, pr0xy!
    I can’t believe I just spent 5 minutes just to println() all of this, but if you’re a coordinator of the following official BINUS University Student Organization websites:
    https://student-activity.binus.ac.id/basishttps://student-activity.binus.ac.id/binaryhttps://student-activity.binus.ac.id/himkahttps://student-activity.binus.ac.id/himsisfohttps://student-activity.binus.ac.id/himti
    You can now give a shoutout to COMPUTERUN 2.0 just by creating a NEWS or ARTICLE and put “COMPUTERUN 2.0” inside of the list of tags. Here’s what I mean:
    So your shiny love and articles can be shown directly to those who are visiting the main COMPUTERUN website, like this!
    Well, that’s all I wanna tell. So, goodbye and see you again!
    yeah, thanks Shift for the amazing println and now let’s continue my discussion;
    speaking ’bout bundles,
    so, we’ve some quirks in our event registration system:
    we separated registration forms for (business-it case || web design) && workshop bundle at https://computerun.id/info/business-it-case-bundle and https://computerun.id/info/web-design-bundle; so if you would like to have that bundle discount, you’ll need to register through that special form (or contact our committees if you’re confused about that);everyone joining sprint, business-it case, && web design will be automatically added to our opening ceremony;
    this means that everyone who’s signing up for the bundles won’t be automatically registered into the respective events (especially when they haven’t done the payments), so please take a while while we’ll accepting ad adding you to the respective events; just don’t forget to finish your payments and tell us if you’re done!
    (ab)using yaml, markdown, && laravel blade?

    (Ab)using YAML and Markdown and Laravel Blade components to generate static pages powering the @Computerun2021 website. This ain’t Jekyll.— Reinhart Previano K. (@reinhart1010) October 22, 2021

    our old COMPUTERUN codebase is written using php && laravel, && we’re mainly using blade to define our layouts; but thanks to our recent efforts, we’re able to build this interactive faq section:
    just by spawning a few lines of yaml code:
    .wp-block-code {
    border: 0;
    padding: 0;
    }
    .wp-block-code > div {
    overflow: auto;
    }
    .shcb-language {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    -webkit-clip-path: inset(50%);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal;
    word-break: normal;
    }
    .hljs {
    box-sizing: border-box;
    }
    .hljs.shcb-code-table {
    display: table;
    width: 100%;
    }
    .hljs.shcb-code-table > .shcb-loc {
    color: inherit;
    display: table-row;
    width: 100%;
    }
    .hljs.shcb-code-table .shcb-loc > span {
    display: table-cell;
    }
    .wp-block-code code.hljs:not(.shcb-wrap-lines) {
    white-space: pre;
    }
    .wp-block-code code.hljs.shcb-wrap-lines {
    white-space: pre-wrap;
    }
    .hljs.shcb-line-numbers {
    border-spacing: 0;
    counter-reset: line;
    }
    .hljs.shcb-line-numbers > .shcb-loc {
    counter-increment: line;
    }
    .hljs.shcb-line-numbers .shcb-loc > span {
    padding-left: 0.75em;
    }
    .hljs.shcb-line-numbers .shcb-loc::before {
    border-right: 1px solid #ddd;
    content: counter(line);
    display: table-cell;
    padding: 0 0.75em;
    text-align: right;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    white-space: nowrap;
    width: 1%;
    }
    title: "FAQ"
    children:
    - type: "faq"
    contents:
    - question: "Can I participate in SPRINT outside of Indonesia?"
    answer:
    - type: "markdown"
    text: "We would like to apologize that SPRINT is currently unavailable to international participants due to concerns with international shipment/delivery of our Finisher Pack."
    - question: "How do I get the STRAVA club link and the upload form?"
    answer:
    - type: "markdown"
    text: "Once your registration has been approved, please come back to this page (under the **Join Now** section) to see the STRAVA club link as well as the running record upload form."
    - question: "Should I pay the Shipment/Delivery Fee first or later?"
    answer:
    - type: "markdown"
    text: "**Yes,** please pay the delivery fee altogether with the registration fee to us."
    - type: "markdown"
    text: "If you are registering for two (2) persons, you'll need to pay the Shipment/Delivery Fee for both."
    - question: "I'm registering for two pax and we're living in the same place. Can I just pay the Shipment/Delivery Fee once for both of us?"
    answer:
    - type: "markdown"
    text: "First, please make sure that both of you agree to do so, since we will **not** be responsible for handling further deliveries once the Finisher Pack(s) have been successfully delivered to you."
    - type: "markdown"
    text: "Then, please let us know via our [LINE Official Account](http://lin.ee/57zX9DW6k) if you would like to do so, so our committees won't deny your application due to false positives for insufficient funds (i.e. you haven't paid the Delivery Fee for the other person)."
    - question: "Will I get refunds if I failed to reach the target?"
    answer:
    - type: "markdown"
    text: "**The registration fees are non-refundable and non-negotiable.** However, paid delivery fees can be refunded to you by contacting us through our [LINE Official Account](http://lin.ee/57zX9DW6k)."
    Code language: YAML (yaml)
    but wait! we’re not just able to make it work in the faq section, but also most of our webpages! webpages explaining all of our events are now completely coded in yaml, our (COMPUTERUN) homepage is now also written in yaml; even our online guidebooks, sponsorship proposal, && media partner proposal are entirely written in yaml!
    this means that COMPUTERUN 2.0 committees wishing to update the page no longer need to understand a bunch of html; just hack that yaml && markdown source files && done! 🔥🔥🔥
    the modernization of the codebase is definitely making it more flexible and quicker to set up for changes; let’s say, when one of your events require an Instagram username; before, we had to modify our registration logic && add a new form to insert your Instagram username, but today we’ll just need to add that additional field directly on our database, and our backend codebase will automatically recognize and start to validate that, too!
    interested in COMPUTERUN 2.0?
    if you’re interested, just head over to the official website at https://computerun.id, or follow and contact us through many ways!
    COMPUTERUN 2.0 is proudly presented not just by us (the folks at https://reinhart1010.id), but also by HIMSISFO (Information Systems Student Association) and HIMTI (Computer Science Student Association), two of the largest official Student Associations in BINUS University! && true, this is our second (or first, ’cause arrays starts at 0, unless you’re R or MATLAB) installation of COMPUTERUN, && this is our first (or 0th) installation to be held internationally!