I started out trying to modify my old scripts that were written in Python 2 and trying to write them in Python 3. After some tinkering around and tweaking of the code I decided to start fresh and try to write my code in a more modular form.
In this project 2 Python files are executed
weather.py gets data from the sensors of the sense HAT and displays them on the 8×8 LED matrix. Depending on the temperature taken the LED screen background color changes lines 20-36 (Since the Sense HAT is placed directly atop the pi, the temperature’s are affected by the CPU temp of the pi). It then logs the data taken by the sensors. The next part of the script sets the orientation of the LED matrix by reading the acceleration data. Finally it prints the data taken to the LED matrix.
web_app.py takes the same data as weather.py but instead of displaying it on the LED matrix it creates a web server and displays it via the web using flask.
weather.html is used with web_app.py to display Sense HAT data on port 5000 of the raspberry pi
I would like to add the ability to setup email alerts using the web interface. I currently have an email module setup to send emails, I just need to figure out how to set the alerts using the web interface.
Rewriting this script was very rewarding and I learned a lot along the way. I learned how to properly setup a requirements file and use flask. This blog post was very helpful in learning how to package Python. This project has been a lot of fun and I will continue to work on it and improve it.
Where I work has a extremely restrictive network that blocks most outbound protocols besides HTTP and HTTPS. I have been struggling to gain remote access to my machines within my work’s LAN. For my Windows machines I use TeamViewer but I was struggling to access my Linux machines. For command line access I first turned to dataplicity which gives you a web interface for your command line. As far as I know dataplicity only works for Debian.
I also wanted VNC access to my machine but I was struggling to figure out how. I eventually found noVNC, a HTML5 VNC client that works in the web browser. I downloaded the git repository
git clone https://github.com/novnc/noVNC.git
and ran the following command from the downloaded repository
./utils/launch.sh --vnc localhost:5901
This started a web server and WebSockets proxy on port 6080. On my firewall I forwarded port 80 to port 6080 on the IP of my target. Now I have VNC access through the web and can access my machine via a web browser.
Lastly I added the command lines to the crontab
sudo crontab -e @reboot vncserver -geometry 1440x900 -depth 24 @reboot sh /home/noVNC/utils/launch.sh --vnc localhost:5901
Saved the changes and rebooted my machine to test. I can now access my machine anywhere from a web browser!
I’ve been working on my resume so I can start selling my services. I was browsing GitHub for resume templates when I discovered Joel Glovier‘s Resume Template Repository. The instructions are straight forward and detailed in the readme file. I forked my own copy and updated the template accordingly following the instructions provided. I was up and running with my own hosted resume at llamafarmer.github.io/resume in no time. For the final touch I wanted this hosted under my own domain name. I updated the CNAME on github to resume.joshsisto.com. Lastly I created two A records for GitHub pointing to 18.104.22.168 and 22.214.171.124 and a CNAME record for resume.joshsisto.com pointing to llamafarmer.github.io/resume.
Forked Repository – https://github.com/jglovier/resume-template
My Repository – https://github.com/llamafarmer/resume
My Hosted Resume – resume.joshsisto.com
Now using HTTPS with SSL on the blog.
My site and blog is hosted by hostgator.I was able to get a free SSL certificate from my hosting provider for one site. After using the automated system and selecting my site a folder named “ssl” was placed in my root directory.
I moved the ssl directory to the public_html directory where my WordPress site is hosted. I downloaded the plugin Really Simple SSL for my site and used the automatic detection and configuration. After the setup my site automatically redirected to the HTTPS but the browser said some items were still insecure. After some googling I discovered another wordpress plugin SSL Insecure Content Fixer. After installing and using the default settings my site in now secure.
I started teaching myself python about 8 months ago. The last 3 months I have been studying and coding consistently. On November 17th, 2016 I posted to my old blog one of my first python projects. I have come a long way since then and wanted to share my story and some of the lessons I’ve learned so far.
When I was first choosing a language to learn I referred to ieee.org 2016 top languages chart. At the time C was the top language. I researched furiously until finally deciding Python. One of the reasons I chose to go with Python was the fact that most major universities were switching to Python as the language of choice for introducing students to computer science. At the time of writing this it is now the no.1 language according to ieee.org.
I started using codecademy but struggled greatly since I had no previous programming experience. Being a very hands on person I decided I would try and take on a project to learn to code. I decided to buy a Raspberry Pi with a Sense HAT and build a mini weather station. The project was a great learning experience. I learned how to install Python, use pip to download and install packages, import modules, and start learning python syntax. About a month after that project I wrote my first python script. The script I wrote queries CoinDesk’s API for the current Bitcoin price and last years Bitcoin price and prints it out. After these two projects I focused on getting my CompTIA Network+ certification and Python got put on the back-burner.
After getting Network+ certified I needed a new Python project to work on. After spending plenty of time going through reddit on /r/learnpython I decided to try learnpython.org. Learnpython.org ended up being a great resource for a beginner such as myself. After completing most of the exercises I moved on to Automate the Boring Stuff. From ATBS I created a few projects such as, a web scraper, smtp alerts, and some web browser automation. I started getting restless again and felt like I needed something new to work on.
A little less than 2 months ago I discovered DataCamp. DataCamp uses data science to teach programming. I am currently enrolled in the Python Developer Career Track and at the time of writing this 80% complete with the course. I’ve enjoyed DataCamp and definitely think it is money well spent so far, I paid $180 for a 1 year subscription. There are several more Python classes available after I finish the current course I am taking and they recently introduced SQL classes that I’m interested in.
The last 2 months I have been spending almost all of my free time working on honing my Python programming skills. I have even been listening to Python podcasts. One of the better Python podcasts I have been enjoying is Talk Python To Me. While listening to the podcast there was a commercial for the Python training provided by the host Michael Kennedy. I really like Michael’s approach to teaching, he provides videos from start to finish and includes his code on github so you can follow along. I prefer to have working code on my workstation instead of working out of an IPython notebook.
That brings us to where I am now. I’ve been working at my current job for almost 6 months now where Python is heavily used. For the last month I have been writing Python scripts that are used in production! I have been able to automate tasks for myself and my employees saving countless hours. At this stage I finally consider myself a beginner programmer. In 8 months I have gone from zero programming experience to writing scripts that are used in production at my job.
It’s been 6 months since I wrote a blog post about my Raspberry Pi Mini Weather Station. I decided to revisit the project and see if I could add to it with my improved Python skills. When I first wrote this script I wasn’t using an IDE and it was immediately apparent when I opened the Python script using PyCharm. The IDE immediately started showing errors all throughout the script. I though about quitting right then and just starting from scratch, until I discovered the “Reformat Code” button in PyCharm. I clicked the button and it fixed over 70 lines. I immediately tested the code and IT WORKED! After fixing the formatting I added some code to fix the orientation of the screen before it starts displaying text. It is amazing how far I have come since I first created that script.
Original article here
This Python 3 script uses the Selenium Package with the Mozilla Gecko Driver to login to the Google Deep Dream Generator and submit images. I have always been fascinated by the Google Deep dream generator since I first heard about it back in 2015. I have been practicing coding in Python for a few months now and decided a fun project would be to automate the process. I discovered the Selenium package from Automate the Boring Stuff for automating simple web browser tasks.
When I first started working on this script I was right clicking in the browser and selecting “Inspect Element” This would give me the HTML data that I could use to click links and buttons on the page. This quickly became very time consuming. In my frustration I searched for a web browser macro recorder and discovered that selenium actually had a browser extension just for this! After downloading the Selenium web browser extension I used it to record all of the actions that I wanted to perform and automate. I then changed the clipboard format to Python and copied and pasted the macros into my IDE and with little modification got them to automate all of the tasks that I wanted in the web browser using Python.
Image Gallery – https://deepdreamgenerator.com/gallery/user/370099
Update – The site has been updated since this script was released with many changes added. These scripts are no longer good 🙁
I’ve renewed my joshsisto.com domain and will begin blogging on here again. I’ve abandoned https://joshsisto.wordpress.com/. I will continue to post projects and what I am currently up to here.