Skip to content

Instantly share code, notes, and snippets.

@ExtevaXT
ExtevaXT / flash.py
Created January 9, 2024 03:41
Flash console window in taskbar
import ctypes
from ctypes import wintypes
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
user32 = ctypes.WinDLL('user32', use_last_error=True)
FLASHW_STOP = 0
FLASHW_CAPTION = 0x00000001
FLASHW_TRAY = 0x00000002
FLASHW_ALL = 0x00000003
@ExtevaXT
ExtevaXT / metanamer.py
Created January 1, 2024 20:17
sync file names to metatag titles
from mutagen.flac import FLAC
import os
for root, dirs, files in os.walk(u"."):
for filename in files:
if filename.endswith(".flac"):
full_path = os.path.join(root, filename)
audio = FLAC(full_path)
title_list = audio.get("title", [])
s = s.replace('"', '″')
s = s.replace('<', '<')
s = s.replace('>', '>')
s = s.replace('*', '*')
s = s.replace('?', '︖')
s = s.replace(':', 'ː')
s = s.replace('/', '/')
s = s.replace('\\', '∖')
public static Transform FindRecursive(this Transform self, string exactName) => self.FindRecursive(child => child.name == exactName);
public static Transform FindRecursive(this Transform self, Func<Transform, bool> selector)
{
foreach (Transform child in self)
{
if (selector(child))
{
return child;
}
if (Input.GetMouseButton(0) && weaponPreviewRectTransform.isMouseOverUI())
{
mPosDelta = Input.mousePosition - mPrevPos;
if (Vector3.Dot(weaponModel.transform.up, Vector3.up) >= 0)
{
weaponModel.transform.Rotate(weaponModel.transform.up, -Vector3.Dot(mPosDelta, Camera.main.transform.right), Space.World);
}
else
{
weaponModel.transform.Rotate(weaponModel.transform.up, Vector3.Dot(mPosDelta, Camera.main.transform.right), Space.World);
using UnityEngine;
using UnityEngine.UI;
public class whatever : MonoBehaviour
{
private void Update()
{
Rect position = this.gameObject.GetComponent<RectTransform>().GetGlobalPosition();
if (position.Contains(Input.mousePosition)) Debug.Log("Yes, it is");
using UnityEngine;
using System.Collections;
public class LightFlickering : MonoBehaviour {
public Light lightSource;
public float flickerInterval = 0.01f; // Time interval between flickers in seconds
public float flickerDuration = 3f; // Duration of each flicker in seconds
void OnEnable()
{
function var_dump_pre($mixed = null) {
echo '<pre>';
var_dump($mixed);
echo '</pre>';
return null;
}
function ToCamelCase($string){
// Max durability -> maxDurability
$words = explode(' ',strtolower($string));
$humps = array_slice($words, 1);
$humps = array_map('ucfirst', $humps);
array_unshift($humps , $words[0]);
return implode($humps);
}
echo ToCamelCase('Max durability');
Bounds _combinedBounds = new Bounds();
Renderer[] renderers = weaponMount.GetComponentsInChildren<Renderer>();
if (renderers.Length > 0)
{
_combinedBounds = (renderers[0].bounds);
for (int i = 1, len = renderers.Length; i < len; i++)
{
_combinedBounds.Encapsulate(renderers[i].bounds);
}
}