Browse Author: dayz

Hey welcome to my lab!My name is Kamil and I do a lot of repetitive things when it comes to my projects. I decided to make a blog about the things I do, so that I can find the things I do constantly easier. Since this is on the web you all will be able to benefit from this and learn news things as I learn them.The site will focus on arduino and raspberry pi tutorials as well as some basic hacking and programming. Thanks for visiting!

How to Create a Simple Python Chatbot on the Raspberry Pi

I have recently been working on a new project that required scraping data from other websites and have been slowly learning python. I usually work with PHP but I knew python will work faster and better. I also have always wanted to create a simple chatbot that I can input text into and it would reply with something meaningful. Creating a chatbot with a huge database of words and actually understanding what is being said is not an easy task and is something that is way over my head. I was browsing Reddit and found out that you can get results in JSON format is you append ‘.json‘ to the end of the URL. This got me thinking, what if I search Reddit with a question or comment and pick a random search result and reply with one of the top comments. This would fill my urge in creating a chatbot and it would also be a good starting point if I ever wanted to go deeper into creating a database and store answers for the chatbot to get a personality of its own.

I figured the Raspberry Pi would be an easy starting point since I have a bunch of them laying around and it is already setup with a Python environment. You can easily replicate this in any Python environment but I tested out my chatbot on the Raspberry Pi.

Objective

To create a chatbot in Python on the Raspberry Pi that searches Reddit and replies using a Reddit comment

Material

You will need the following:

Instructions

Create a new file on the Raspberry Pi and call it main.py Continue Reading

Google FooBar – Level 2 – Lovely Lucky LAMBs – Python

I’ve recently been learning Python and was invited to the Google Foobar challenge. Google Foobar is an invitation only event that appears if Google detects that you’ve been searching for Python or Java related topics. You can accept the even and complete 5 levels which if you complete you will be able to fill out your personal information for a chance at an interview at Google. My skills aren’t the best but I had some trouble figuring out some of the levels so I decided to publish my submissions in hopefully helping someone out. This level was especially difficult since I didnt quite understand the approach to it and had to figure out the Fibonacci Sequence.

Objective

To complete the Google Foobar Level 2 challenge, Lovely Lucky Lambs

Instructions

This puzzle was a little tricky. I figured out the way to get the first half by doubling the values. The second part of the puzzle requires the knowledge of the Fibonacci Sequence and without knowing the Fibonacci Sequence and numbers you would be lost in this level.  You’ll notice that up on top of my code I return the number 8 as one of the answers if the total lambs is equal to 917503. This is the answer for ‘Test 9’ of the 10 tests that Google runs your code through. My code will not output the correct answer for Test 9 so I had to brute-force the answer. My code should work for this level to pass all 10 tests. Continue Reading

How to install Doom on the Raspberry Pi 3

Doom is a classic DOS game and has been ported to many operating systems and now you can play it on your Raspberry Pi in just a few minutes. You can even setup a joystick or controller to play Doom and relive your childhood memories. You can also download a ton of WAD’s (“Wheres all the Data”) for Doom. WAD’s are like old school mods and include new levels, weapons and really just transform your Doom playing experience. There are many WAD’s out there right now which make the game completely different.

We’ll be using the Chocolate Doom port today to install and play Doom. Chocolate Doom try’s to mimic the original experience of Doom as much as possible. Chocolate Doom’s main features are its accurate reproduction of the game as it was played in the 1990s. We’ll be downloading the source for Chocolate Doom and building and compiling the code on the Raspberry Pi, so this may be a new experience for some people but I promise it is very easy to do.

Objective

To install and play Doom on the Raspberry Pi 3

Material

You will need the following:

Instructions

We’ll be installing the latest version of Chocolate Doom, which as of this tutorial is 3.0.0. You can check to see if there are new version’s by clicking here. You would just need to modify the ‘wget‘ commands and directory commands below to match the version and file names that you downloaded. Continue Reading

Google FooBar – Level 1 – Braille Translation – Python

I’ve recently been learning Python and was invited to the Google Foobar challenge. Google Foobar is an invitation only event that appears if Google detects that you’ve been searching for Python or Java related topics. You can accept the even and complete 5 levels which if you complete you will be able to fill out your personal information for a chance at an interview at Google. My skills aren’t the best but I had some trouble figuring out some of the levels so I decided to publish my submissions in hopefully helping someone out.

Objective

To complete the Google Foobar Level 1 challenge, Braille Translation

Instructions

This level should be straight forward. You will simply need to create a Braille lookup tables list or array and translate the words given to you in Braille. You will need to interpret if the letter is capital as well as spaces. Below is the Google Foobar challenge. I ended up looking up what the Braille Charchets should be from the Braille Wikipedia page. If you notice from the Braille page it shows the Braille dots for the letters A to Z but they do not match the pattern Google wants you use so I had to manually create a list in the correct binary order. Continue Reading

How to Check your PiVPN logs on your Raspberry Pi

If you are running your PiVPN on your Raspberry Pi it is most likely exposed to the internet so that you can use your VPN away from your house. You will definitely want to make sure your Raspberry Pi is up to date with the latest security updates as well as checking your logs periodically to see if anyone has attempted to gain access to your system or worse, to see if anyone has accessed your system.

Objective

To use VNC to access our Raspberry Pi Remotely

Material

You will need the following:

Instructions

I will assume you are running Raspbian on your Raspberry Pi and have already installed PiVPN using the tutorial here. You are most likely running your Raspberry Pi headless if this is your PiVPN server so you will need to SSH into your Raspberry Pi. If you are not running your Raspberry Pi headless you can still run the same commands below in your terminal. Continue Reading

How to use VNC to Remote Desktop to the Raspberry Pi

VNC stands for Virtual Network Computing and it allows us to remote into our Raspberry Pi and view a graphic interface of our desktop environment over the network. You can use your mouse and keyboard over the network and have full remote access to the Raspberry Pi over your network. You can even forward your VNC connection over your router or VPN and access your Raspberry Pi from anywhere in the world. We will be using a program called ‘RealVNC‘ to access our Raspberry Pi from any computer on the network. Our Raspberry Pi will act as the server and the computer running RealVNC will be the client.

When you connect to your Raspberry Pi using the VNC software you will get a Remote Desktop view that opens in a new Window and you can minimize and maximize it. You can also set up your Raspberry Pi without a monitor and use the Remote Desktop connection as your monitor. Installing the VNC on your Raspberry Pi is very easy and doesn’t require much configuration since Raspbian sets up VNC pretty easy right out of the box.

Objective

To use VNC to access our Raspberry Pi Remotely

Material

You will need the following:

Instructions

I will assume you are running Raspbian on your Raspberry Pi. I have tested this procedure with a Raspberry Pi running Stretch, but it should work for older and new builds. If there are any issues just leave a comment below.

You’ll need access to your Raspberry Pi to run some commands. You can also run these commands over SSH if you have enabled SSH in case you Raspberry Pi is headless and running without a monitor. You can enable SSH by following the tutorial here.

Continue Reading