Skip to content

Instantly share code, notes, and snippets.

View jupiterbjy's full-sized avatar
💭
Meow

jupiterbjy

💭
Meow
  • E8
  • 05:29 (UTC +09:00)
View GitHub Profile
@jupiterbjy
jupiterbjy / pseudo_random_picker.py
Created July 11, 2024 03:08
Some generic pseudo random tool
"""
Pseudo Random Picker from CSV input
:Author: jupiterbjy@gmail.com
"""
import random
YELLOW = "\033[93m"
GREEN = "\033[92m"

My systemd user service for managing minecraft. I used with screen for years but now decided to ditch it in favor for RCON or ingame commands.

change directories and name accordingly.

mkdir -p ~/.config/systemd/user/
vim ~/.config/systemd/user/simplycreate.service

systemctl --user daemon-reload
systemctl --user start simplycreate.service
@jupiterbjy
jupiterbjy / make_root_red.sh
Last active June 18, 2024 23:16
make colorless root become red, so it can be 3 times faster bs-tary
#!/bin/bash
# copy .bashrc & .bash_logout first
# https://superuser.com/a/268703/1252755
cp /etc/skel/.bash* ~
# Append the new PS1 setting to .bashrc
echo 'export PS1="\[\e[31m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\$ "' >> ~/.bashrc
# Reload the .bashrc to apply changes
@jupiterbjy
jupiterbjy / selenium_and_kivy_asyncio.py
Last active June 11, 2024 02:36
Sample code that implements using selenium and kivy in conjunction with asyncio.
import asyncio
from kivy.app import App, Builder
from kivy.properties import StringProperty, BooleanProperty
from kivy.uix.widget import Widget
import selenium.webdriver
# --- CONFIG ---
@jupiterbjy
jupiterbjy / export_collections_with_structure.py
Last active June 12, 2024 14:39
exports merged gltf file for objects in each collection, while retaining structure of collections as directories. Also properly selects armature's parented objects automatically.
"""
Blender batch export script with subdir / auto centering / output redirection.
Exports all objects in respective collections that doesn't start with IGNORE_PREFIX.
Files will be saved in script's named subdir, which means script must be saved first.
No need to center every object into world center - script will handle that.
Written by jupiterbjy@gmail.com
@jupiterbjy
jupiterbjy / export_with_collection_structure.py
Last active June 8, 2024 20:06
Export blender file's all objects while retaining collection structure as directories. Also selects armature and it's parented objects for proper exporting
"""
Blender batch export script with subdir / auto centering / output redirection.
Exports all selected objects into individual files specified in EXPORT_TYPE.
All files will be saved in script's named subdir.
No need to center every object into world center - script will handle that.
Written by jupiterbjy@gmail.com
@jupiterbjy
jupiterbjy / copy_img_with_dir.py
Last active May 16, 2024 13:29
Some script to copy images to temp dir with same dir structure. Used to copy images only from clipstudio drawings folder.
import pathlib
import shutil
ROOT = pathlib.Path(__file__).parent
TEMP = pathlib.Path("X:/extemp")
TEMP.mkdir(exist_ok=True)
EXT_WHITELIST = {".webp", ".png", ".jpg", ".jpeg", ".apng", ".gif"}
@jupiterbjy
jupiterbjy / calc_digit_mp.py
Created May 15, 2024 06:12
Some random code to demonstrate mp
# won't run on notebook
import multiprocessing as mp
import time
from os import getpid
from typing import Tuple
MAX_CPU = 6
@jupiterbjy
jupiterbjy / search_content.py
Last active May 22, 2024 07:20
Searchs thru source codes and find lines where keyword appears
"""
MIT License
Copyright (c) 2024 jupiterbjy@gmail.com
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
@jupiterbjy
jupiterbjy / cpp_variant_and_visit.cpp
Created April 8, 2024 05:56
Some test code to see behavior of `std::variant` and `std::visit`
#include <iostream>
#include <string>
#include <variant>
template<class... Types>
struct overloaded : Types... { using Types::operator()...; };
template<class... Types>
overloaded(Types...)->overloaded<Types...>;