Skip to content

bobbyliujb/fun_project

Repository files navigation

Projects for Fun

Swappa Notifier

v1.1

  • Read Swappa link and user email from command line. Read specification from command line.
  • Usage: nohup python3 swappa.py <swappa-link> <target-email> <price(integer)> <time-interval(seconds)> (test) > myout.out 2>&1. The last test argv is for test only, which will not actually send the email.
  • Might be treated as spam email. Need to check the first email from my email and add to whitelist by setting filter.
  • TODO: Add DB to support email to multiple subscription and unsubscription.

v1.0

  • Python 3.6 with sendgrid. Hardcoded time interval, email addresses, target url, etc. Get HTML page and analyze some key information. Filter by price and send to target email.
  • Usage: nohup python3 swappa.py > myout.out 2>&1. Need to export environment variables like export SENDGRID_API_KEY=SG.xxx and export [email protected]. GCloud compute engines seems to clear environment variables regularly.
  • TODO: Support custom specification for filtering(price, check-interval)

Auto login

  • Auto login Leetcode every day to win 1 Leetcode coin(= =).
  • Use debian crontab to run the py script daily.
  • Use selenium to simulate form filling and button clicking.

Referral Scraping

  • Get referral information from 1p3a.
  • Libraries for python3:
      pip3 install bs4 selenium oauth2client gspread
    
  • Use Google spreadsheet API to write content onto personnal spreadsheet.
  • Need chromedriver to run. Install on Ubuntu. Set headless options in code.
  • Deployed on GCP, with tmux to run without interruption. with crontab to schedule run.
      gcloud config set project project-name
      gcloud config set zone zone-xxx
      gcloud compute --project "project-anme" ssh --zone "zone-xxx" "instance-name"
      crontab -e
       0 0,6,12,15,18,21 * * * /usr/bin/python3 /home/bobby/referral.py 40 20 /home/bobby/token.json xxx /usr/lib/chromium-browser/chromedriver > /home/bobby/py.log 2>&1
       0 1 * * * /usr/bin/python3 /home/bobby/mianjing_onsite.py 300 500 /home/bobby/token.json xxx /usr/lib/chromium-browser/chromedriver > /home/bobby/py_onsite.log 2>&1
       0 3 * * * /usr/bin/python3 /home/bobby/mianjing_oa.py 300 50 /home/bobby/token.json xxx /usr/lib/chromium-browser/chromedriver > /home/bobby/py_oa.log 2>&1
    
  • For personal study only. Never use the data for any kind of business activities!

About

Some personal projects for fun

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published