Week 1
This page describes my first week in the “How to do (almost) anything” (JVC) course.
Setting Up Git & SSH
I began by setting up Git and linking my VS Code with GitLab. I created an SSH key. Below are some frequently used commands:
git status # Checks the repository status
git pull origin main # Pulls latest changes from GitLab
git add .
git commit -m "Message"
git push origin main # Stages, commits, and pushes updates
ssh-keygen -t rsa -b 4096 -C "trckalu1@student.cvut.cz" # Generates SSH key
ssh -T git@gitlab.fel.cvut.cz # Tests the SSH connection
Once my key was added on GitLab, I could work without passwords.
Local Hosting
To host my site locally, I used a server.py
script in
Python.
After allowing Python through my firewall, I could open
http://192.168.X.X:8000
on devices in the same network.
Thanks to that, even my dad in the living room can open the site
if he’s on the same WiFi.
import http.server
import socketserver
import socket
PORT = 8000
hostname = socket.gethostname()
local_ip = socket.gethostbyname(hostname)
Handler = http.server.SimpleHTTPRequestHandler
Handler.extensions_map.update({
".html": "text/html; charset=UTF-8",
".css": "text/css; charset=UTF-8",
".js": "application/javascript; charset=UTF-8",
"": "application/octet-stream; charset=UTF-8",
})
with socketserver.TCPServer(("0.0.0.0", PORT), Handler) as httpd:
print(f"Serving at: http://{local_ip}:{PORT}/")
print("Accessible on other devices in the same network.")
httpd.serve_forever()
Summary
In Week 1, I focused on establishing my Git workflow, testing local hosting, and setting up a script to automatically compress images.