Skip to content

Instantly share code, notes, and snippets.

@glcoder
glcoder / FindComponentByName.asl.cs
Created January 15, 2024 22:51
Unity Auto Splitter FindComponentByName helper method (asl-help is used).
Func<IntPtr, string, IntPtr> GameObjectFindComponentByName = null; // for recursive call
GameObjectFindComponentByName = (ManagedGameObjectPtr, ComponentName) =>
{
if (ManagedGameObjectPtr == IntPtr.Zero)
return IntPtr.Zero;
var NativeGameObjectPtr = vars.Helper.Read<IntPtr>(ManagedGameObjectPtr + 0x10 /* ManagedGameObject.m_CachedPtr */);
if (NativeGameObjectPtr == IntPtr.Zero)
return IntPtr.Zero;
@glcoder
glcoder / GenerateDataDSP.py
Last active October 30, 2023 19:03
Generate DSP data.json for factorio-lab using extracted by uTinyRipper assets.
#!/usr/bin/python
import os
import sys
import yaml
import json
import pprint
import textwrap
import unityparser
from skimage import io
@glcoder
glcoder / AndroidManifest.xml
Last active December 16, 2021 08:10
GoogleSignInClient sample usage
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.change.please">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="SampleSignIn"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true">
cmake_minimum_required(VERSION 2.6)
project(gl3w)
include(FindPythonInterp)
if(PYTHONINTERP_FOUND)
execute_process(COMMAND ${PYTHON_EXECUTABLE} gl3w_gen.py
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif(PYTHONINTERP_FOUND)
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
@glcoder
glcoder / mandelbrot.c
Last active August 29, 2015 14:09
Mandelbrot set plotter
#include<stdio.h>/* this code draw Mandelbrot set and save it into BMP file */
unsigned long h[]={7753026UL,128L,7733248UL,2621440UL,268435456UL,268435456UL,
65536L,4L,0L,0L,0L,1048576L,0L,0L,65280L,336920320UL,673775380UL,1010630440UL,
1347485500UL,1684340560UL,2021195620UL,2358050680UL,2694905740UL,3031760800UL,
3368615860UL,3705470920UL,4042325980UL,4210753520UL,4294967290UL,4294967295UL}
;int main(int n,char**f){FILE*o=fopen("fractal.bmp","wb");if(NULL==o)return 1;
;fwrite(h,1L,118L,o);**f=0;int c,x,y;for(y=-2048;y<2048;++y)for(n=0,x=-3000;x<
1096;n=00,++x){float i,j,k;i=j=k=0;while(i*i+j*j<4&&n++<16){i=i*i-j*j+x/1600.0
;j=2*k*j+y/1600.0;k=i;}c=**f?fputc((c<<4)|(n&15),o):n&15;**f=!**f;}fclose(o);}
@glcoder
glcoder / agif.py
Created February 13, 2014 11:22
Easy way to make an animated GIF from video file.
#!/usr/bin/env python
import os
import shutil
import sys
import getopt
# animated GIF maker
# typical usage: ./agif.py -i input.mp4 -w 640 -f 8 -t 00:00:08.50 -l 00:00:07.50 -d 10 -o output.gif
@glcoder
glcoder / FlxU-sign.patch
Created April 21, 2012 16:06
Utility sign function for Flixel
diff -Bbwur AdamAtomic-flixel-8989e50/org/flixel/FlxU.as AdamAtomic-flixel-8989e50-new/org/flixel/FlxU.as
--- AdamAtomic-flixel-8989e50/org/flixel/FlxU.as 2011-08-22 09:03:52 +0400
+++ AdamAtomic-flixel-8989e50-new/org/flixel/FlxU.as 2012-04-21 20:04:29 +0400
@@ -20,6 +20,18 @@
}
/**
+ * Extract the sign of a number.
+ *
+ * @param Value Any number.
@glcoder
glcoder / FlxEmitter.patch
Created April 21, 2012 15:45
Patch for Flixel's FlxEmitter
diff -Bbwur AdamAtomic-flixel-8989e50/org/flixel/FlxEmitter.as AdamAtomic-flixel-8989e50-new/org/flixel/FlxEmitter.as
--- AdamAtomic-flixel-8989e50/org/flixel/FlxEmitter.as 2011-08-22 09:03:52 +0400
+++ AdamAtomic-flixel-8989e50-new/org/flixel/FlxEmitter.as 2012-04-21 19:11:42 +0400
@@ -123,7 +123,7 @@
minRotation = -360;
maxRotation = 360;
gravity = 0;
- particleClass = null;
+ particleClass = FlxParticle;
particleDrag = new FlxPoint();