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 / Audio-Merge.md
Created December 6, 2022 06:58 — forked from shadowmoose/Audio-Merge.md
Merge multiple audio tracks inside a video file

About

This is a simple script to combine two of a video file's audio tracks into one. It doesn't impact the video's quality.

To make things even more simple, it only prompts for an input/output video using file selectors. The rest is handled automatically.

This is a simple utility to rapidly "fix" videos with split audio tracks, such as those recorded by ShadowPlay or OBS.

To use this script, simply copy/paste the "merge.ps1" code below into a new file named "merge.ps1", then launch it.

@etherealxx
etherealxx / Middleify.ahk
Created January 9, 2023 03:24
Useful Autohotkey script for my 2560x1080 monitor
;ethx
; Ctrl+Win+X will change the current focused window resolution to 1920x1080 positioned in the middle, and pressing again will revert to the previous state.
; Ctrl+Win+Z will toggle the behavior of taskbar (auto hide)
; Ctrl+Win+C will toggle visibility of taskbar (show/hide)
; Ctrl+Win+V is supposed to toggle hide all window and restore it back. Currently it cannot restore all the window back.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;#Warn ; Enable warnings to assist with detecting common errors, disabled because changing the taskbar behavior will show a warning.
; variables to store the original size and position of the window
@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

@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

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 / 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)
@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 / 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 / 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 / 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" (