Python and SQLite
Create a Table if it Does not Exist:
Create a Table if it Does not Exist:
Open Specific Database with SQLite: Note: If you don’t designate a database a temporary one will be created which will ceae to exist when you exit. Exit Console: Open database from SQLite Console: .open database_name.db […]
This is the basic code to make an API request of the OpenAI API with Python. Make sure to install the OpenAI Python Package.
This class shows you how to use regex to match specific patterns such as email addresses, ip addresses and MAC addresses in strings
This class shows you how to strip out characters from strings to prevent injection attacks, and to format the text so that yo can store clean data.
This class explains the basic concepts of filtering user input with Python and why it matters. The lab shows how to create a loop that requests text that is formatted properly for the scripts needs.
This class shows you how to use the OS Module to interact with the operating system and gain access to applications and tools that reside on the OS.
This class shows you how to use REST API’s in Python. You will get variable values from one API and pass it to another. NOTE: (ERROR) rest-text.py requests-copy.py location-json.py pretty-json.py json-module.py
This class will teach yo how to use Try Statements. This allows you to try to take an action with an API, or OS command and if it does not work then do something else.
This class shows you how to make your scripts more interactive for users with the input() function, argparse module and shebangs.
This class teaches you how to write and use custom functions in Python.
File Modes: write.py web.py text.py read.py file-path.py path-cwd.py example.py data.txt
This class shows you how to use Lists and Dictionaries in Python. basic-list.py list-sort.py add-remove-list.py split-list.py basic-dict.py add-remove-dict.py nested-list.py
This class teaches you to use venv Virtual Environments with Python.
This class will teach you the basics of using Modules, Functions and PIP in Python.
This class will teach you about While and For loops in Python.
This class shows you how to write if/else if/ else statements with numbers and strings.
example.py
Setup: This is a Free REST API so you just need the URL. Please note that there is a rate limit of one request per second. https://www.macvendorlookup.com 1-mac.py This lab will print out the vendor […]
Setup: 1-transcript.py This lab pulls the YouTube Transcript for a video and prints it out as both JSON, and plain text. 2-gpt.py This lab summarizes a YouTube video, and creates Tags using ChatGPT. 3-timecode.py This […]
WARNING: “Fair Use” is not a global right. It is an American concept that does not have a corresponding legal concept in many countries. Even in the United States Fair Use is not set in […]
1-state.py This code retrieves alerts about a state and then prints them to the screen. Using the JSON module you can format the JSON response into a “pretty” format so that its easier to understand […]
WARINING: “Fair Use” is not a global right. It is an American concept that does not have a corresponding legal concept in many countries. Even in the United States Fair Use is not set in […]
API Websites: Code: This code will get your external IP Address, and then use that to find geographic information.
Setup: Create Images with DALL E: Download DALL E Images: Edit Image with DALL E: Create Variation of Image with DALLE:
This class shows you how to use Python to interact with the ChatGPT API and create your own AI powered apps. openai-streamed.py openai-nonstreamed.py openai-autoblog.py
This test shows allows you to talk to your computer, have ChatGPT answer you, and then have that spoken by your computer. ai-speech.py
chatgpt-demo.py dalle-demo.py
With this project we create an IoT Environmental control device that uses a MariaDB (MySQL) database as the datastore. This allows you to use database functionality to create log files and be able to corrrelate […]
In this project we are going to use an Arduino to get the room temperature, and be able to turn on a regular house fan. The Arduino sends the temperature value to the Raspberry Pi […]
This project allows you to get a temperature value from the Arduino, pass it to the Raspberry Pi, have a Python Script process that value and store it in a file, then have a PHP […]
You can send data to a Raspberry Pi from an Arduino, have the Pi compute the data and use “intelligence” to send the Arduino a command. This allows you to fully use a Pi as […]
You can send commands to an Arduino from an Raspberry Pi using a USB cable and Serial Communication. Prerequisites: Raspberry Pi – How to Begin Coding Python on Raspberry Pi Arduino – Send Commands with […]
You can connect a Raspberry Pi to your Arduino with a USB cable and read the Serial Output into Variable Values. Prerequisites: Analog Temperature Sensor with Arduino Raspberry Pi – How to Begin Coding Python […]
With the Arduino IDE Serial Monitor you can send commands to your Arduino. Functional Parts in the Project: Arduino Uno – https://store.arduino.cc/usa/arduino-uno-rev3 560 Piece Jumper Wire Kit – https://amzn.to/2MsCLjL 220 Ohm Resistors – https://amzn.to/2RiiMD9 Breadboard Kit – https://amzn.to/2Xih5ei LED […]
Dig allows you to find public DNS information about Domains. So if you need to check MX records for your company, or see if there is an issue with a SaaS provider by finding theer […]
IPinfoDB offers a free IP Geography API that is compatible with basic PHP. This allows you to try to determine location of the cloud servers that you use for your organization. Remember that is basically […]
Nmap allows you to map your network from the Linux Command Line. You can determine IP Addresses, Mac Addresses, Open Ports, and even Operating Systems. This information can be outputted to a human readbale text […]
In this project we parse an nmap XML output file and then add the values to a MySQL Database Table. We then create a basic report that pulls the values out of the database and […]
These are the notes for importing data from XML document into MySQL, and then to print a simple report. parse.php nmapReport.php MySQL Setup nmapTest.xml
This project shows you how to parse (read) the nmap XML output file and turn ip addresses, mac addresses, hostnames, vendors and ports into PHP variable values and then print them out. Prerequisite Classes: Linux […]
This project allows you to create a simple network scanner that is accessible from a web browser on the network. Essentially with this project we use a Cron Job every 10 minutes to trigger nmap […]
The standard Ubuntu Desktop works well on a Raspberry Pi 4 with 4GB of RAM. To get the Desktop Environment simply install the Ubuntu Server and then install the Ubuntu-Desktop on to it. Prerequisite Classes: […]
You can install Ubuntu very easily on the Raspberry Pi. Ubuntu Server and IoT Core versions come preloaded with the Raspberry Pi Imager Software. Note: Ubuntu Server will automatically start an auto update process when […]
SAMBA allows you to use SMB/CIFS to do traditional/ windows type file management over the network. You can access files and folders just like you would on a windows network without needing to install additional […]
You can turn your Raspberry Pi with Raspberry PI OS into a full LAMP web server. We use MariaDB because MySQL is not provided in the main repository and it is a drop in replacement […]
The Pi Hole software allows you to turn your Raspberry Pi into a DNS Security device. After setup your client systems can use the Pi Hole as their DNS server, when websites try to resolve […]
The GPIOzero Python Package allows you to control and read from the GPIO Pins on your Raspberry Pi. GPIOzero is included in the Raspberry Pi Operating System, and can be installed on other distros. GPIOzero […]
With Thonny you can easily begin to code Python Scripts on Raspberry Pi OS. Thonny is a very simple Python IDE that is easy to learn.
The Raspberry Pi OS is a distribution of Debian Linux that is generally used on Raspberry Pi Systems. The GUI is simple, but can be a bit cinfusing when you start to use it. Raspberry […]
Installing an Operating System on a Raspbery Pi is easy, but very different than installing an OS on a standard PC. You download the Imager software from Raspberry Pi, and then you image your Micro […]
The Raspberry Pi is an ARM PC that gives you the ability to use the GPIO pins for sensor inputs and outputs. ARM based PC’s look and act like x86 PC’s, but require specific Operating […]
You can find your Network Settings and assign the values to variables.
This project creates a time lapse camera using a 5MP ArduCam. You can set the lapse interval to however many seconds you want, and then the camera will take a picture at that interval. Note […]
This project logs and alerts when a speed limit value is passed. You can assign a value as a Speed Limit and when that speed is passed the Red LED lights up, and the location […]
This project shows you how to create a tracking device that logs location and speed of the device to an SD card, and also displays the infromation to an LCD Screen. Notes: We use an […]
This project uses the Adafruit Ultimate GPS Module, an Arduino Uno with WiFi and a 20×4 I2C LCD Screen to display your location in Degrees and show your speed of travel. Note: When I did […]
This project uses a PIR to trigger the ArduCam to record a video file and store it as an .AVI on the SD Card. It names the video file based on a random number generation […]
This project allows you to create a Motion Detection Spycam with a PIR Sensor, and ArduCam, and a Data Logging Shield with Real Time Clock. This project takes a pictures when motion is detected, saving […]
This class teaches you to save images from your ArduCam to an SD card using a Unix Timestamp for the name. This is useful not just as a timestamp, but also as a way to […]
The ArduCam can store pictures to an SD for your Arduino projects. Note In memorysaver.h set the ArduCam and module that you are using. ArduCam uses SPI and I2C so the SD Module or Shield […]
This project is a full sensor suite device for a garden or your indoor plants. This has a Moisture Sensor, Temperature/ Humidity Sensor, Light Sensor and Real Time Clock that output to a 20×4 LCD […]
3 Color RGB LED’s allow you to use a single LED to show multiple colors. Functional Parts in the Project: Arduino Uno – https://store.arduino.cc/usa/arduino-uno-rev3 560 Piece Jumper Wire Kit – https://amzn.to/2MsCLjL 220 Ohm Resistors – https://amzn.to/2RiiMD9 Breadboard Kit […]
This project shows the Date, Time, Temperature, Humidity and Alerts you when the temperature breaks a threshold and gives you a timestamp of highest temperature reached. Prerequisite Classes: Arduino – I2C 20 x 4 LCD […]
The DHT11, 21 and 22 Sensors can be used to determine both temperature and humdity. Note: Make sure to comment/ uncomment the right sensor in setup Links: Adafruit DHT Library – https://github.com/adafruit/DHT-sensor-library Functional Parts in […]
A Real Time Clock module gives the ability for an Arduino to keep track of the current time, and be able to track time even when the device loses power. Many libraries for Clock Modules […]
This is an easy to use library to add RTC to an Arduino. http://www.rinkydinkelectronics.com/library.php?id=73
This project shows you how to log Variable Values to an SD Card using a Data Logging Module. Prerequisite Classes: Analog Temperature Sensor with Arduino Functional Parts in the Project: Arduino Uno – https://store.arduino.cc/usa/arduino-uno-rev3 Breadboard Kit […]
This project allows you to use an Arduino Uno with WiFi to scan for wireless networks and print out the results on a 20×4 I2C display. Prerequisite Classes: Arduino – I2C 20 x 4 LCD […]
This uses an Arduino Uno with Wifi and a 20×4 I2C LCD Screen. Plug the LCD into the SCL and SDA ports, NOT into A$ and A5. Make sure to install the Liquid Crystal Library […]
This project shows you how to send commands from one Arduino Uno with WiFo to another without needing a server. This is a simple Analog Temperature Sensor Project that Turns on LEDS on the other […]
This project allows me to send commands directly from one Arduino Wifi to another. The SENSOR Arduino has an analog temp sensor and sends commands to the RECEIVER. The RECEIVER Parses the commands ?red or […]
The IoT Relay from Digital Loggers Inc allows to easily and safely control standard american powered appliances such as fans, dehumidifiers, pumps and such. It is important to realize how the 4 power ports work. […]
You can send commands to your Arduino Uno with WiFi thorough connection URL’s with wget on Linux. This is a simple way to add Arduino Commands to your scripts and web apps. wget https://www.gnu.org/software/wget/ http://manpages.ubuntu.com/manpages/bionic/man1/wget.1.html […]
This project uses a server with PHP to send commands to the Arduino Vehicle. The commands are sent use shell_exec and triggering wget on the command line. wget needs to be installed on your server. […]
I’m working on building a remote control car using the Arduino Uno with WiFi and the FeeTech Vehicle platform.
You can find the Minimum and Maximum values in a column using SQL. min() https://dev.mysql.com/doc/refman/8.0/en/group-by-functions.html https://www.w3schools.com/sql/func_mysql_min.asp max() https://www.w3schools.com/sql/func_mysql_max.asp https://dev.mysql.com/doc/refman/8.0/en/group-by-functions.html
You can pull the average of the numeric values in a column with SQL in MySQL. avg() https://dev.mysql.com/doc/refman/8.0/en/group-by-functions.html https://www.w3schools.com/sql/func_mysql_avg.asp
In MySQL you can list the unique values from a column in a Table. DISTINCT https://dev.mysql.com/doc/refman/8.0/en/distinct-optimization.html https://www.w3schools.com/sql/sql_distinct.asp
The time() and date() functions allow you to add time data to your applications. Time() provides the seconds since Unix Epoch (January 1, 1970) which is useful for basic timing in your application. The date() […]
Text transformation in PHP is useful not just for esthetics, but to also make sure that data is uniform when dealing with databases and such. strtolower() https://www.php.net/manual/en/function.strtolower.php https://www.w3schools.com/php/func_string_strtolower.asp strtoupper() https://www.php.net/manual/en/function.strtoupper.php https://www.w3schools.com/php/func_string_strtoupper.asp ucfirst() https://www.php.net/manual/en/function.ucfirst.php https://www.w3schools.com/php/func_string_ucfirst.asp ucwords() […]
You can use the tool belenaEtcher to create a bootable installation flash drive for Ubuntu. https://www.balena.io/etcher/
The explode() function allows you to turn a String into an Array based on a separator you define. explode() https://www.php.net/manual/en/function.explode.php https://www.w3schools.com/php/func_string_explode.asp explode.php
The var_dump() function allows you to see what a variable’s data type is, and what it’s value is. var_dump() https://www.php.net/manual/en/function.var-dump.php https://www.w3schools.com/php/func_var_var_dump.asp varDump.php
You can have your HTML document auto refresh itself so that d=ynamic information is continuously updated. <meta http-equiv=”refresh” content=”5″> https://www.w3schools.com/tags/att_meta_http_equiv.asp autoUpdate.php
The strpos() function allows you to parse strings in PHP. strpos() https://www.php.net/manual/en/function.strpos.php https://www.w3schools.com/php/func_string_strpos.asp strpos.php
In this example we use exec() to ping domain names and IP addresses and then parses the results so that you can test the results using an If/Else statement. exec() https://www.php.net/manual/en/function.exec.php unset() https://www.php.net/manual/en/function.unset.php https://www.w3schools.com/php/func_var_unset.asp strpos() […]
This is a simple Up/Down network monitor to show what your server is able to see on the network and internet. shell_exec() https://www.php.net/manual/en/function.shell-exec.php shellExecPingArray.php
The shell_exec() function allows you to send commands to the Command Line using PHP. You can use this for everything from pinging websites, to calling installed apps such as FFMPEG. shell_exec() also returns the results […]
The pathinfo() function allows you to turn a filepath into an Array and then interact with the keys of the Array. You can grab the Filename, Extension, Folder Name and Basename. pathinfo() https://www.php.net/manual/en/function.pathinfo.php https://www.w3schools.com/php/func_filesystem_pathinfo.asp pathinfo.php
The in_array() function allows you to check if a value is stored with an Array. This can be used for things such as creating an array of which states a company ships products to. in_array() […]
If you allow you users to upload files to your web server you will probably want to create some restrictions. You can block uploads based off of file size, extension, or if a filename already […]
With an HTML form and PHP you can upload files to your web server. When you use $_FILE in PHP you are able to access information about the file stored in the $_FILE array. Prerequisites: […]
The isset() function in PHP checks to see if the value of a variable has been set. this can be useful in applications that allow users to login, or make sure that variables are actually […]
The glob() function in PHP allows you to search folders and put the results into an array based on basic filtering. glob() https://www.php.net/manual/en/function.glob.php https://www.w3schools.com/php/func_filesystem_glob.asp glob.php glob.php (with Image Embed)
$ Session Variables allow you to set Variable Values that can be accessed across all pages that your user goes to in your PHP Web Application. You must use session_start() on all pages that will […]
You can send Variable Names and Values using hyperlinks to PHP Scripts. This is an easy way to send variable data, but is incredibly insecure. To send a variable to a PHP script add ?variable_name=variable_value […]
In this project we build the ability to search for images based on Tags stored in MySQL. Previous Classes in Series: PHP Project (Simple) – Dynamic Photo Gallery Stream PHP Project (Simple) – Dynamic Photo […]