Skip to content

Instantly share code, notes, and snippets.

View SpotlightForBugs's full-sized avatar
:atom:
I am coding. At least I am pretending to be...

Johannes Häusler SpotlightForBugs

:atom:
I am coding. At least I am pretending to be...
View GitHub Profile
@SpotlightForBugs
SpotlightForBugs / bot.py
Created April 4, 2025 22:26
Telegram bot that removes non-admin invite link messages
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
import logging
import os
import re
import random
from aiogram import Bot, Dispatcher, F
@SpotlightForBugs
SpotlightForBugs / Readme.md
Created March 21, 2025 21:54
SQLite to JSON Converter - A Python utility that automatically converts all tables from a SQLite database to JSON format.

SQLite to JSON Converter

A Python utility that automatically converts all tables from a SQLite database to JSON format.

Description

This tool provides a simple command-line interface to export all tables from a SQLite database file (.db) to JSON format. It can generate individual JSON files for each table or combine all tables into a single JSON file.

Features

#!/usr/bin/env python3
import argparse
import json
import os
import sqlite3
from pathlib import Path
def get_all_tables(conn):
"""Get all table names from the SQLite database."""
# Get-BitLockerVolume | ForEach-Object { Disable-BitLocker -MountPoint $_.MountPoint } # if you want to decrypt all drives
while ($true) {
# Run manage-bde -status and process line by line
cmd /c 'manage-bde -status' | ForEach-Object {
# If the line indicates a Volume line, just display it
if ($_ -match '^Volume [A-Z]:') {
Write-Host $_
}
@SpotlightForBugs
SpotlightForBugs / story.md
Last active March 16, 2025 21:06
Fredrick's Absurd Adventure | Frederick the Talking rock

Fredrick's Absurd Adventure

Chapter One (or Maybe Twenty)

Once upon a time, in a land not so far, but too far to walk to, lived a talking rock named Fredrick. Now, Fredrick wasn’t any ordinary rock—he had legs but no arms, so he couldn’t clap, which made him incredibly sad. But Fredrick had a mission: he wanted to become a baker, because, well, rocks need bread too, apparently. So, Fredrick began his journey toward the bakery, which was located on the tallest hill in a desert. Why a bakery would be in a desert is anyone's guess, but Fredrick was determined.

On his way, Fredrick met a purple giraffe named Gerald, who was riding a bicycle upside down. Gerald, being the sensible giraffe he was, said, "If you want to bake bread, you need flour made of clouds. But, the clouds have gone on strike, so good luck with that."

Fredrick, undeterred, decided to find the nearest sky market, where he could negotiate with the clouds. However, to his dismay, the sky market was only open on Wednesdays,

ÿØÿà JFIF  ` ` ÿá €Exif II*        J   R (   i‡  Z `  `      Ð    a ÿá
http://ns.adobe.com/xap/1.0/ <?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about=''
xmlns:Attrib='http://ns.attribution.com/ads/1.0/'>
<Attrib:Ads>
<rdf:Seq>
<rdf:li rdf:parseType='Resource'>
(Get-WmiObject -Query "SELECT * FROM Win32_DiskDrive WHERE MediaType='Removable Media'"|%{Get-WmiObject -Query "ASSOCIATORS OF {Win32_DiskDrive.DeviceID='$($_.DeviceID)'} WHERE AssocClass=Win32_DiskDriveToDiskPartition"|ForEach-Object{Get-WmiObject -Query "ASSOCIATORS OF {Win32_DiskPartition.DeviceID='$($_.DeviceID)'} WHERE AssocClass=Win32_LogicalDiskToPartition"|ForEach-Object{$_.DeviceID}}}|Sort-Object{(Get-Item $_).LastWriteTime}-Descending|Select-Object -First 1)
@SpotlightForBugs
SpotlightForBugs / pymerge.py
Created October 16, 2023 07:14
A simple script to merge multiple python files into each other
# This script merges two or more python files into one
# It assumes that the files are in the same directory and that there are no circular imports
# It also assumes that the functions have unique names within each file, but they may have duplicates across files
# It uses a prefix for the functions based on the file name
# It handles different types of import statements and only replaces the imports if there is a matching python file to be merged
# It also checks if the merged file is runnable and reports any errors or warnings
import os
import re
import sys
import json
import os
import sys
import webbrowser
import customtkinter
import json2html
import requests
from selenium import webdriver

Interfaces In General: Enhancing Java Flexibility and Code Modularity

👨‍💼🚀 Excited to share some insights on interfaces in Java! 📚

Interfaces play a pivotal role in Java development, providing a powerful tool for achieving flexibility, code modularity, and maintaining a clear separation between different components. Let's dive into the world of interfaces and see how they contribute to building robust and extensible software solutions. 💡

The Power of Abstraction

Interfaces serve as a contract between classes, defining a set of methods that must be implemented by any class that implements the interface. By leveraging this abstraction, we can create a higher level of interaction between classes without exposing their internal details. 🤝