Hey everyone! Today, we had an exciting Linux installation session at our college. We expected many to do a full Linux installation, but instead, we set up dual boot on 10+ machines!
Topics Covered: Syed Jafer β FOSS, GLUGs, and open-source communities Salman β Why FOSS matters & Linux Commands Dhanasekar β Linux and DevOps Guhan β GNU and free software
Challenges We Faced
BitLocker Encryption β Had to disable BitLocker on some laptops BIOS/UEFI Problems β Secure Boot, boot order changes needed GRUB Issues β Windows not showing up, required boot-repair
This is a Python-based single-file application designed for typing practice. It provides a simple interface to improve typing accuracy and speed. Over time, this minimal program has gradually increased my typing skill.
What I Learned from This Project
2D Array Validation I first simply used a 1D array to store user input, but I noticed some issues. After implementing a 2D array, I understood why the 2D array was more appropriate for handling user inputs.
Tkinter I wanted to visually see and update correct, wrong, and incomplete typing inputs, but I didnβt know how to implement it in the terminal. So, I used a simple Tkinter gui window
Run This Program
It depends on the following applications:
Python 3
python3-tk
Installation Command on Debian-Based Systems
sudo apt install python3 python3-tk
Clone repository and run program
git clone https://github.com/github-CS-krishna/TerminalTyping cd TerminalTyping python3 terminalType.py
Redis, a high-performance in-memory key-value store, is widely used for caching, session management, and various other scenarios where fast data retrieval is essential. One of its key features is the ability to set expiration times for keys. However, when using the SET command with the EX option, developers might encounter unexpected behaviors where the expiration time is seemingly lost. Letβs explore this issue in detail.
Understanding SET with EX
The Redis SET command with the EX option allows you to set a keyβs value and specify its expiration time in seconds. For instance
SET key value EX 60
This command sets the key key to the value value and sets an expiration time of 60 seconds.
The Problem
In certain cases, the expiration time might be unexpectedly lost. This typically happens when subsequent operations overwrite the key without specifying a new expiration. For example,
SET key value1 EX 60
SET key value2
In the above sequence,
The first SET command assigns a value to key and sets an expiration of 60 seconds.
The second SET command overwrites the value of key but does not include an expiration time, resulting in the key persisting indefinitely.
This behavior can lead to subtle bugs, especially in applications that rely on key expiration for correctness or resource management.
Why Does This Happen?
The Redis SET command is designed to replace the entire state of a key, including its expiration. When you use SET without the EX, PX, or EXAT options, the expiration is removed, and the key becomes persistent. This behavior aligns with the principle that SET is a complete update operation.
When using Redis SET with EX, be mindful of operations that might overwrite keys without reapplying expiration. Understanding Redisβs behavior and implementing robust patterns can save you from unexpected issues, ensuring your application remains efficient and reliable.
In this blog, Iβll walk you through the journey of transitioning from a PythonAnywhere server to GitHub Actions for automating the delivery of daily quizzes to a Telegram group https://t.me/parottasalna . This implementation highlights the benefits of GitHub Actions to run a cronjob.
Problem Statement
I wanted to send a daily quiz to a Telegram group to keep members engaged and learning. Initially, I hosted the solution on a PythonAnywhere server.
Some of the limitations are,
Only one cron job is allowed for a free account.
For every x days, i need to visit the dashboard and reactive my account to make it work.
Recently, started learning the Github Actions . So thought of leveraging the schedule mechanism in it for my usecase.
Key Features of My Solution
Automated Scheduling: GitHub Actions triggers the script daily at a specified time.
Secure Secrets Management: Sensitive information like Telegram bot tokens and chat IDs are stored securely using GitHub Secrets.
Serverless Architecture: No server maintenance; everything runs on GitHubβs infrastructure.
A Python script (populate_questions.py) to create questions and store each question in the respective directory.
A Python script (runner.py) which takes telegram_bot_url, chat_id and category as input to read the correct question from the category directory and send the message.
A GitHub Actions workflow to automate execution.
Workflow Yaml File
name: Docker Quiz Sender
on:
schedule:
- cron: "30 4 * * *"
workflow_dispatch:
jobs:
run-python:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run script with secrets0
run: python runner.py --telegram_url ${{ secrets.TELEGRAM_BOT_URL }} --chat_id ${{ secrets.CHAT_ID }} --category docker
Benefits of the New Implementation
Cost-Effectiveness: No server costs thanks to GitHubβs free tier for public repositories.
Reliability: GitHub Actions ensures the script runs on schedule without manual intervention.