Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View KTibow's full-sized avatar

Kendell R KTibow

View GitHub Profile
@KTibow
KTibow / hangman_guesser.py
Last active June 20, 2020 17:05
A simple Hangman guesser with Python
# Setup word list. Download if not there
# Note: "string" means the thing we're trying to guess
from urllib.request import urlopen
from os.path import isfile
from re import sub
from string import ascii_lowercase
print("Loading...")
if isfile("words.txt"):
words = open("words.txt", "r").read().split("\n")
else:
@KTibow
KTibow / regex_crawler.py
Last active June 20, 2020 17:18
Web crawler in Python with Regex!
# Libs
import re
from urllib.request import urlopen
from urllib.parse import urlparse
yoursite = "https://www.google.com/"
crawllist = [{"url": yoursite, "crawled": False}]
undecodable = []
depth = 5
for i in range(depth):
nlist = []
@KTibow
KTibow / cipher.py
Created June 30, 2020 21:17
Simple word-shift ceaser cipher
def cipher(inputstr, shift=4):
outputstr = ''
for char in inputstr:
charnum = ord(char) - shift
if charnum > 122:
charnum = ((charnum - 97) % 26) + 97
elif charnum < 97:
charnum = ((charnum - 97) % 26) + 97
outputstr += chr(charnum)
return outputstr
@KTibow
KTibow / themes.yaml
Created July 17, 2020 17:41
Themes for Home Assistant Lovelace slightly modified from JuanMTech
# Thanks @JuanMTech! I've slightly modified their themes a little.
Google Light Theme:
# Header:
app-header-background-color: "#f3f5f7"
app-header-text-color: "#000"
# Main Interface Colors
primary-color: "#5F9BEA"
light-primary-color: var(--primary-color)
primary-background-color: "#f3f5f7"
secondary-background-color: var(--primary-background-color)
@KTibow
KTibow / welcome.yaml
Created July 17, 2020 19:24
Welcome a person in Home Assistant
cards:
- content: >
# <center>{% if is_state('binary_sensor.evening', 'on') %} Good evening {%
elif is_state('binary_sensor.night', 'on') %} Have a good night {% elif
is_state('binary_sensor.morning', 'on') %} Good morning {% endif
%} {{user}}</center>
style:
.: |
ha-card {
--paper-card-background-color: none !important;
@KTibow
KTibow / humidifier.yaml
Created July 17, 2020 19:33
Neat humidifier controller for Home Assistant
cards:
- entities:
- entity: switch.kendell_s_humidifier
name: Direct control
- entity: humidifier.upstairs_bedroom
- entity: sensor.filtered_temperature
- entity: sensor.filtered_humidity
show_header_toggle: false
style: |
ha-card {
@KTibow
KTibow / app-zoom-in-5-lines.py
Last active November 14, 2020 19:02
Who says that zoom's server can't be created in 5 lines?
from flask import Flask
app = Flask(__name__)
@app.route("/j/<meeting_id>")
def join(meeting_id):
return f"<iframe src='zoommtg://zoom.us/join?confno={meeting_id}' style='display: none;'></iframe>"
@KTibow
KTibow / hangman_guesser.py
Last active December 13, 2021 00:45
Simple hangman game guesser written in Python.
# Simple hangman guesser by @KTibow
# Get the possible words from the file
import string
all_words = open("words_alpha.txt").read().splitlines()
# Get how long the word is
word_length = int(input("How long is the word? "))
word_letters = [[] for i in range(word_length)]
possible_words = []
@KTibow
KTibow / index.html
Last active January 16, 2022 19:18
Sends you a notification when your Prusa Mini+ finishes (change IP in server.py)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Printer Notifier</title>
<style>
body {
background: #282233;
color: white;
import pygame
pygame.init()
width = 1024
height = 1024
screen = pygame.display.set_mode((width, height))
bg = pygame.Surface((width, height), pygame.SRCALPHA)
font = pygame.font.SysFont("Ubuntu", 64)