Skip to content

Instantly share code, notes, and snippets.

Hyper Sonic hsandt

Block or report user

Report or block hsandt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hsandt
hsandt / set_all_track_numbers_from_name.py
Created Dec 28, 2018
A simple Python script that sets the track number of all (supposedly) audio files found in folder "tracks" based on their respective names
View set_all_track_numbers_from_name.py
#!/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 Oct 24, 2018
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.
View toggle_touchpad_gsettings.py
#!/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
[Unity] C# editor script containing static methods to build a project for Android and iOS
View CommandLineBuild.cs
// 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 Jan 21, 2017
Build and run on a connected iOS device from command-line (even if Unity Editor does not support auto-run for current Xcode version)
View buildandrun-ios.sh
# 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 May 24, 2016
Build and run a Unity project on a connected Android device from command-line (requires Unix-like shell on Windows)
View buildandrun-android.sh
# 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
Unity engine GameObject extensions : get component, instantiate and clone objects
View GameObjectExtensions.cs
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
An EditorWindow for Unity that captures the exact Game View content
View EditorScreenshot.cs
// 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;
You can’t perform that action at this time.