Skip to content

Instantly share code, notes, and snippets.

View etherealxx's full-sized avatar
💭
still learning stuff

Etherealxx etherealxx

💭
still learning stuff
View GitHub Profile
@etherealxx
etherealxx / GDQuest 3D WorldEnvi.tscn
Created September 6, 2024 08:18
pretty Godot 3D WorldEnvirontment template, just instantiate it as a child to your 3d scene tree that hasn't had a WorldEnvironment node yet
; Compiled by me into a single instantiable Godot 4 scene
; MIT No Attribution License
; https://opensource.org/license/MIT-0
; Copyright (c) 2024 Etherealxx
;
; Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.
;
; THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@etherealxx
etherealxx / tictactoe.cpp
Created November 15, 2023 11:39
Object oriented tic tac toe.
// 2023 Jibril Wathon
// github.com/etherealxx
// Public Domain
#include <iostream>
#include <vector>
using namespace std;
class TicTacToeBoard {
@etherealxx
etherealxx / setupcondaenv.bat
Last active August 31, 2023 00:33
Automatically install Miniconda3 on a new Windows device -> Make a new env -> Install all required packages from a cloned repo
@echo off
set file_name=%~n0
:checkconda
if exist C:\ProgramData\miniconda3\Scripts\activate.bat (
call C:\ProgramData\miniconda3\Scripts\activate.bat C:\ProgramData\miniconda3
REM The python file must have the same name as this batch file, located at the same folder
python %file_name%.py
) else (
if exist "%userprofile%\miniconda3\Scripts\activate.bat" (
@etherealxx
etherealxx / spotifyresize.py
Created May 25, 2023 06:24
resize spotify x window
import subprocess
def get_window_ids():
cmd = "xwininfo -root -tree | grep spotify"
output = subprocess.check_output(cmd, shell=True).decode("utf-8")
lines = output.strip().split("\n")
window_ids = []
for line in lines:
window_info = line.split('"')
@etherealxx
etherealxx / tkinter_compare.py
Created May 9, 2023 10:31
Tally to compare 2 values.
#tkinter compare
import tkinter as tk
class App(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
@etherealxx
etherealxx / tktwovariabletally.py
Created April 19, 2023 13:28
A tally to compare two variable, made with Tkinter
#github.com/etherealxx
import tkinter as tk
class App(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
@etherealxx
etherealxx / heictojpg.py
Created April 6, 2023 13:51
Convert HEIC images to JPG in linux
#sudo apt-get install libheif-examples
import os, subprocess, shlex
dapath = "/home/ethereal/Downloads/Documents"
for file in os.listdir(dapath):
if file.endswith(".HEIC"):
heicpath = os.path.join(dapath, file)
heicname = file.partition(".")[0]
jpgpath = os.path.join(dapath, heicname + ".jpg")
command = f"heif-convert -q 100 {heicpath} {jpgpath}"
splitcommand = shlex.split(command)

About

Drag and drop file or folder into the .bat file, and it will convert the path of said folder/file into a python variable, which can be used later.

Rename the .bat file to the same name as your python file in order for it to work (no need to tweak the inside of the .bat file). And make sure both the .bat file and the .py file are in the same directory.

Tested work on Windows 11.

@etherealxx
etherealxx / colab-logram.md
Last active January 19, 2023 23:20
Log the ram usage of Google Colab in background every 10 seconds.

About

This piece of code when ran in a single cell in Google Colab, will log the usage of the ram every 10 seconds into /content/process_ram_usage.txt. And you can use other cells while this cells is running (in background).

When you're done logging, use log_process.kill() on a new cell

@etherealxx
etherealxx / ChatGPT-WordCleaner.md
Created January 9, 2023 03:43
Cleans a MS Word document containing a long ChatGPT session from excess empty paragraph

About

When you have a long session in ChatGPT, maybe you want to save it locally. I used some of the chrome extension out there, sadly it can't handle long session with hundreds of paragraph. So i usually copy all the text there into MS Word. The problem is, when you select the text to copy, your profile picture is also selected, which turns into your email address in Word. The other problem is on the copied document, distance between a single question-and-answer to another is 4 line.

This script uses python-docx to iterate through all line of a word document, and remove all email address and excess empty lines. There's also an option to remove all line starts with >, i use it personally.

Don't forget to install python-docx before using the script:

pip install python-docx