Skip to content

Instantly share code, notes, and snippets.

"""word game"""
import random
words = [
"python", "elephant", "giraffe", "astronomy", "bicycle", "mountain",
"keyboard", "engineer", "umbrella", "butterfly", "adventure", "strawberry",
"laptop", "library", "treasure", "happiness", "galaxy", "volcano",
"champion", "puzzle", "mystery", "diamond", "explorer", "football", "journey"
]
# Import the requests module
import requests
# Function to make a GET request to an API
def get_api_data(url, params=None):
"""
Makes a GET request to the provided URL with optional parameters.
Parameters:
url (str): The API endpoint to send the request to.
# Import the necessary libraries
from PIL import Image
import numpy as np
# ASCII characters used to represent pixel brightness
ASCII_CHARS = "@%#*+=-:. "
def resize_image(image, new_width=100):
"""
Resizes an image to a given width while maintaining aspect ratio.
// Function to generate a random number between two values
function randomBetween(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Function to generate a random HSL color
function generateRandomHSL() {
const hue = randomBetween(0, 360); // Hue (0-360)
const saturation = randomBetween(50, 100); // Saturation (50-100%)
const lightness = randomBetween(40, 80); // Lightness (40-80%)
@Collinsnyamao
Collinsnyamao / neon_text_glow_effect.html
Last active September 13, 2024 12:11
Neon text glow
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neon Text Glow Effect</title>
<!-- Link to the external CSS file -->
<link rel="stylesheet" href="style.css">
</head>
<body>
import threading
import requests
from bs4 import BeautifulSoup
import sqlite3
import logging
import time
from queue import Queue
# Setup logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
@Collinsnyamao
Collinsnyamao / assignment-1.ipynb
Created October 27, 2025 20:23
Spatial Data Analysis: Assignment 1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.