Skip to content

Instantly share code, notes, and snippets.

View hsandt's full-sized avatar

Hyper Sonic hsandt

View GitHub Profile
@hsandt
hsandt / Godot template.desktop
Last active January 10, 2024 15:06
Install Godot 3 stable or 4 beta, rc or stable and create desktop entry for Linux
[Desktop Entry]
Name=Godot Engine $VERSION $CHANNEL
GenericName=Libre game engine
Comment=Multi-platform 2D and 3D game engine with a feature-rich editor
Exec=godot$VERSION_$CHANNEL %f
Icon=$HOME/.local/share/applications/godot.png
Terminal=false
Type=Application
MimeType=application/x-godot-project;
Categories=Development;IDE;
@hsandt
hsandt / README.md
Last active September 1, 2020 03:02
PICO8 0.1.11g and 0.1.12c skip intro patches for Linux 64-bit

Patches to skip the splashscreen and logo/version display when the PICO-8 editor starts. Intended for development purpose only.

Please check the thread: https://www.lexaloffle.com/bbs/?tid=3485. It contains instructions on how to reproduce the patch for different versions and OSes.

Download one of the patches below matching your PICO-8 version, then patch your binary.

At first I didn't manage to upload binaries as raw gists, so I pasted binary dumps instead so you could convert them back to binaries with xxd reverse dump operation xxd -r my.patch.txt > my.patch.

But I managed to upload the binaries by cloning the repo and pushing the new files back, so now both the dump and raw versions of the patches are available.

@hsandt
hsandt / exec.py
Last active May 23, 2019 19:45
exec.py from Sublime Text 3.1.1 (Build 3176) patched for thread safety to avoid empty console output on build task
# Patched based on answer at https://github.com/SublimeTextIssues/Core/issues/2293 by kaste
# Copy it to your Packages/Default/exec.py
# Use OverrideAudit (https://github.com/OdatNurd/OverrideAudit/) to detect official script changes on Sublime Text upgrades
# Extra:
# - use read1 instead of read
# - use start_new_session=True instead of preexec_fn
import collections
import functools
@hsandt
hsandt / set_all_track_numbers_from_name.py
Created December 28, 2018 18:43
A simple Python script that sets the track number of all (supposedly) audio files found in folder "tracks" based on their respective names
#!/usr/bin env python3
# This is a very simple gist based on
# https://stackoverflow.com/questions/8948/accessing-mp3-meta-data-with-python/34970600#34970600
# to add track number metadata to music when the tracks are formatted as "{track_number}_Title.mp3"
# but the track number is missing in metadata.
# This script doesn't check that the file is an mp3, only that the file starts with a number.
# If you need another separator than '_', replace it directly in the script or add a parameter "separator"
# that you would pass to the script.
@hsandt
hsandt / toggle_touchpad_gsettings.py
Created October 24, 2018 13:27
A Python script that toggles the touchpad for Linux via gsettings. Useful when the toggle touchpad function key doesn't work and vendor-specific command lines do not apply to your computer.
#!/usr/bin/python3.6
import sys
import subprocess
gsettings_schema, gsettings_key = "org.gnome.desktop.peripherals.touchpad", "send-events"
def get_touchpad_send_events():
send_events_value = subprocess.check_output(["gsettings", "get", gsettings_schema, gsettings_key])
return send_events_value.strip()
@hsandt
hsandt / CommandLineBuild.cs
Created May 24, 2016 21:12
[Unity] C# editor script containing static methods to build a project for Android and iOS
// Usage: set the projectName you want, then run:
// [Unity executable path] [custom arguments] -executeMethod CommandLineBuild.Build[AndRun][Platform][Development] [-version VERSION]
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Linq;
public class CommandLineBuild
@hsandt
hsandt / buildandrun-ios.sh
Last active October 14, 2023 13:24
Build and run on a connected iOS device from command-line (even if Unity Editor does not support auto-run for current Xcode version)
# Platform: OS X
#
# Role: pull last repository changes, then build and run on a connected iOS device
#
# Usage: ./buildandrun-ios.sh [version] [--run-only]
#
# Parameters:
# version version number (e.g. "v0.2", "v4rc3", etc.) for your Unity build name
# --run-only set this if the Unity project was already build and you don't want to rebuild it
#
@hsandt
hsandt / buildandrun-android.sh
Last active September 14, 2023 19:48
Build and run a Unity project on a connected Android device from command-line (requires Unix-like shell on Windows)
# Platform: Windows with Unix-like shell (Git Bash recommended)
#
# Role: pull last repository changes, then build and run on a connected Android device
#
# Usage: ./buildandrun-android.sh [version] [--run-only]
#
# Parameters:
# version version number (e.g. "v0.2", "v4rc3", etc.) for your Unity build name
# --run-only set this if the Unity project was already build and you don't want to rebuild it
#
@hsandt
hsandt / GameObjectExtensions.cs
Created May 19, 2016 21:52
Unity engine GameObject extensions : get component, instantiate and clone objects
public static class GameObjectExtensions {
/// Try to get component of type T, log error if none found
public static T GetComponentOrFail<T>(this GameObject gameObject) where T : Component {
T component = gameObject.GetComponent<T>();
if (component == null)
throw ExceptionsUtil.CreateExceptionFormat("No component of type {0} found on {1}.", typeof(T), gameObject);
return component;
}
@hsandt
hsandt / EditorScreenshot.cs
Created May 15, 2016 17:03
An EditorWindow for Unity that captures the exact Game View content
// Created by Long Nguyen Huu
// 2016.05.15
// MIT License
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Linq;
using System.Reflection;