Skip to content

Instantly share code, notes, and snippets.

@cigumo
cigumo / upload-steam-achievements.lua
Last active April 2, 2023 08:04
Script to upload achievements to Steam
--
-- Creates new achievements in steam and uploads the corresponding images.
--
-- WARNING: Based in a non-official API used internally by Steam. Can break anytime!
-- REQUIRES:
-- - lua 5.2/5.3 or luajit 2.0
-- - cURL (in path)
-- - json.lua https://github.com/rxi/json.lua
--
-- Created by Ciro on 02 Sep 2018.
@cigumo
cigumo / profiler.lua
Created October 20, 2018 03:23
luajit 2.1 + love2d simple profiler
--
-- use with luajit 2.1 profiler
-- klua.log functions not included! make your own :)
-- to be used with love2d
local log = (require 'klua.log'):new('profiler'); log.level = DEBUG_LEVEL
local G = love.graphics
local profile
local vmdef
@cigumo
cigumo / init.lua
Last active November 13, 2020 23:34
hammerspoon ultra simple window manager with modal keywords
------------------------------------------------------------
-- ccc window manager
------------------------------------------------------------
cccwm = {}
-- config
cccwm.config = {
grid_base = {w=6,h=8},
grids = {
@cigumo
cigumo / p_outline.c
Created October 22, 2018 21:08
p_outline.c
extern vec2 c_size; // canvas size
extern number c_ss; // canvas supersampling
extern number thickness;
extern vec4 outline_color;
extern int samples;
extern number threshold;
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords)
{
@cigumo
cigumo / gist:c7a27aee4a8dec01cd8757432c0430a7
Created October 17, 2018 02:53
wegame-crashguid-B9B0AE22-9352-4205-AFA0-7441698B1E8D.json
{
"version": "1002",
"CrashGUID": "B9B0AE22-9352-4205-AFA0-7441698B1E8D",
"AppName": "RailPlatformGame_2000212",
"AppVersion": "0.0.0.23",
"ImageName": "G:\\WeGame\\rail_apps\\王国保卫战:前线(2000212)\\Kingdom Rush Frontiers.exe",
"OperatingSystem": "Windows 10 Home China Build 17134",
"ProjectID": "2000212",
"UIN": "90457445",
"OSIs64Bit": "1",
@cigumo
cigumo / 0001-changes-SDL_AndroidGetInternalStoragePath-to-return-.patch
Created January 10, 2018 04:05
[PATCH] changes SDL_AndroidGetInternalStoragePath to return a canonical path
diff --git a/love/src/jni/SDL2-2.0.5/src/core/android/SDL_android.c b/love/src/jni/SDL2-2.0.5/src/core/android/SDL_android.c
index b93b1625..e11fe3c5 100644
--- a/love/src/jni/SDL2-2.0.5/src/core/android/SDL_android.c
+++ b/love/src/jni/SDL2-2.0.5/src/core/android/SDL_android.c
@@ -1665,10 +1665,14 @@ const char * SDL_AndroidGetInternalStoragePath()
return NULL;
}
- /* path = fileObject.getAbsolutePath(); */
+ /* path = fileObject.getCanonicalPath(); */
@cigumo
cigumo / gist:840575d91c7479c1dd18f28c569de05e
Created January 10, 2018 02:16
physfs doMkdir patch to allow creating dirs when symlinks are part of the path
modified love/src/jni/physfs-2.1.0/src/physfs.c
@@ -2014,7 +2014,8 @@ static int doMkdir(const char *_dname, char *dname)
const int rc = h->funcs->stat(h->opaque, dname, &statbuf);
if ((!rc) && (currentErrorCode() == PHYSFS_ERR_NOT_FOUND))
exists = 0;
- retval = ((rc) && (statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY));
+ retval = ((rc) && (statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY ||
+ (allowSymLinks && statbuf.filetype == PHYSFS_FILETYPE_SYMLINK)));
} /* if */
@cigumo
cigumo / love_shader_array_length_test.lua
Created December 29, 2017 14:36
glsl shader compiler ignores .length() access and removes the variable
local shader
local shader_code = [[
extern vec4 col[2];
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords)
{
//float dummy = col[0][0];
return vec4(1/col.length(),0,1,1);
}
]]
bool Filesystem::setSource(const char *source)
{
if (!PHYSFS_isInit())
return false;
// Check whether directory is already set.
if (!game_source.empty())
return false;
std::string new_search_path = source;
@cigumo
cigumo / gist:316ef0e4d149b26d7a34ac0a0cf3eca3
Created September 16, 2017 22:55
Spelunky Classic - ASCII tiles table
"!" oShopkeeperTile
"#" oGoldIdolTile
"$" oGoldBarTile
"%" oSpectaclesTile
"&" oWebTile
"(" oMattockTile
")" oLeavesTile
"*" oGoldBarsTile
"+" oSmashTrapTile
"-" oPistolTile