Skip to content

Instantly share code, notes, and snippets.

View qwe321qwe321qwe321's full-sized avatar
💣
Counting down

PeDev qwe321qwe321qwe321

💣
Counting down
View GitHub Profile
@qwe321qwe321qwe321
qwe321qwe321qwe321 / Godot-BuiltinInputActions.cs
Last active April 18, 2024 16:44
[Godot .Net] A class for Godot with Built-in Input Actions as C# constants.
public static class BuiltinInputActions
{
public static readonly StringName UIAccept = "ui_accept";
public static readonly StringName UISelect = "ui_select";
public static readonly StringName UICancel = "ui_cancel";
public static readonly StringName UIFocusNext = "ui_focus_next";
public static readonly StringName UIFocusPrev = "ui_focus_prev";
public static readonly StringName UILeft = "ui_left";
public static readonly StringName UIRight = "ui_right";
public static readonly StringName UIUp = "ui_up";
@qwe321qwe321qwe321
qwe321qwe321qwe321 / BurstTest.cs
Last active February 28, 2024 05:26
Unity Burst Compiler Direct Call comparison
using Unity.Burst;
using Unity.Burst.CompilerServices;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Profiling;
public class BurstTest : MonoBehaviour
@qwe321qwe321qwe321
qwe321qwe321qwe321 / SteamCDKeyActivated.gs
Last active February 6, 2024 23:22
Query Steam CD Keys for activation on Steamworks in Google Spreadsheet Apps Scripts.
// Inspired from https://gist.github.com/petersvp/270f7d5d7d548448f4897586a0d389c0 and https://gist.github.com/Jimbly/9f6c6a0d9414310347f2803902ac7bb7
// 1. GO TO Steamworks, into the Query CD Key page, here: https://partner.steamgames.com/querycdkey/
// *Make sure your language is "English".
//
// 2. Having a Google Spreadsheet with the following format in a row:
// | KEY | Sent (checkbox) | Note | Activated |
// (You can modify the format by changing the Column constants.)
//
// 3. Call validateKeyActivated_All or validateSheetKeyActivated_ActiveSheet.
@qwe321qwe321qwe321
qwe321qwe321qwe321 / BurstCompileTest.cs
Last active June 6, 2021 07:03
Test Unity Burst Compiler performance in different scenarios. (Burst: 1.5.3, Unity: 2019.4.17f1)
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
using MathRandom = Unity.Mathematics.Random;
using UnityEngine;
using System;
using System.Runtime.InteropServices;
using UnityEngine.Profiling;
@qwe321qwe321qwe321
qwe321qwe321qwe321 / BetterCoroutine.cs
Last active July 10, 2020 04:38
BetterCoroutine is a wrapper of UnityEngine.Coroutine to make it safe and convenience. It provides a better approach to access and maintain the coroutine status and lifecycle.
/*
* BetterCoroutine is a wrapper of UnityEngine.Coroutine.
* It provides a better approach to access and maintain the coroutine status and lifecycle.
* Created by PeDev 2020 https://gist.github.com/qwe321qwe321qwe321/958c405524dbad0a12aa06589936d52e
*/
using System.Collections;
using UnityEngine;
namespace Pedev {
@qwe321qwe321qwe321
qwe321qwe321qwe321 / PSDImporterHelper.cs
Last active July 10, 2020 04:15
The helper class to expose some *REQUIRED* non-public members in the UnityEditor.U2D.PSD.PSDImporter. Such as TextureImporterSettings(Readable), TextureImporterPlatformSettings, "Character Rig", and "Use Layer Grouping".
/*
* The PSDImporterHelper is to expose some IMPORTANT non-public members in PSDImporter.
* Such as TextureImporterSettings(Readable), TextureImporterPlatformSettings, "Character Rig", and "Use Layer Grouping".
* Created by PeDev 2020 https://gist.github.com/qwe321qwe321qwe321/74ed2c0e8722b0b88c84ddb402d253e6
*/
#if UNITY_EDITOR
#define INCLUDE_PSD_IMPORTER // <---- Comment/Uncomment by yourself.
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
@qwe321qwe321qwe321
qwe321qwe321qwe321 / SimpleCursorLocker.cpp
Created May 1, 2020 05:50
Simple Cursor Locker is a simple program to lock the cursor with the specific axis(X/Y axis). It's helpful in some design programs which do not have this feature.
#include<cstdio>
#include<windows.h>
using namespace std;
bool IsKey(int key);
int main() {
const int enableKeyX = VK_F6;
const int enableKeyY = VK_F7;
printf("//////////////////////////////\n");
printf("==== Simple Cursor Locker ====\n");

With GitHub Actions, a workflow can publish artifacts, typically logs or binaries. As of early 2020, the life time of an artifact is hard-coded to 90 days (this may change in the future). After 90 days, an artifact is automatically deleted. But, in the meantime, artifacts for a repository may accumulate and generate mega-bytes or even giga-bytes of data files.

It is unclear if there is a size limit for the total accumulated size of artifacts for a public repository. But GitHub cannot reasonably let multi-giga-bytes of artifacts data accumulate without doing anything. So, if your workflows regularly produce large artifacts (such as "nightly build" procedures for instance), it is wise to cleanup and delete older artifacts without waiting for the 90 days limit.

Using the Web page for the "Actions" of a repository, it is possible to browse old workflow runs and manually delete artifacts. But the procedure is slow and tedious. It is fine to delete one selected artifact. It is not for a regular cleanup. We need

@qwe321qwe321qwe321
qwe321qwe321qwe321 / SimpleXOR.cpp
Created February 12, 2020 00:42
XOR two files
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define MAX_KEY_BYTE 65536
int binSize(FILE *fp) {
fseek(fp, 0, SEEK_END); // seek to end of file
int size = ftell(fp); // get current file pointer
@qwe321qwe321qwe321
qwe321qwe321qwe321 / StickyController.cs
Created August 5, 2019 09:07
A sticky platformer controller from the game PROJECT1ON in GMTKJam2019. https://itch.io/jam/gmtk-2019/rate/463690
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Clipping;
using VFX;
[RequireComponent(typeof(Rigidbody2D))]
[RequireComponent(typeof(StickyAnimationController))]
public class StickyController : MonoBehaviour {
private static StickyControoler s_Instance;