Skip to content

Instantly share code, notes, and snippets.

View smbss1's full-sized avatar
🏠
Working from home

Softands smbss1

🏠
Working from home
View GitHub Profile
@smbss1
smbss1 / dictionary.c
Created January 8, 2020 13:08 — forked from rosshays/dictionary.c
C Dictionary (map) Implementation
#include "dictionary.h"
#include <stdlib.h>
#include <stdbool.h>
////////////////////////////////////////////////////////////////////////////////
// static function forward declarations
// dictionary node static
static DictionaryNode *DictionaryNodeAlloc(void);
@smbss1
smbss1 / Reference.cs
Created May 29, 2020 20:32 — forked from Lazersquid/Reference.cs
Unity generic scriptable object variable reference pattern
using System;
/// <summary>
/// Reference Class.
/// </summary>
[Serializable]
public abstract class Reference
{
}
@smbss1
smbss1 / SerializedPropertyExtensions.cs
Created May 30, 2020 01:05 — forked from douduck08/README.md
Use Reflection to get instance of Unity's SerializedProperty in Custom Editor.
// <author>
// douduck08: https://github.com/douduck08
// Use Reflection to get instance of Unity's SerializedProperty in Custom Editor.
// Modified codes from 'Unity Answers', in order to apply on nested List<T> or Array.
//
// Original author: HiddenMonk & Johannes Deml
// Ref: http://answers.unity3d.com/questions/627090/convert-serializedproperty-to-custom-class.html
// </author>
using System.Collections;
@smbss1
smbss1 / MathParabola.cs
Created July 3, 2022 23:29 — forked from ditzel/MathParabola.cs
A simple Math class to calculate a point in 2D or 3D space lying on a parabola. And a more complex parabola controller that you can put on an object.
using UnityEngine;
using System;
public class MathParabola
{
public static Vector3 Parabola(Vector3 start, Vector3 end, float height, float t)
{
Func<float, float> f = x => -4 * height * x * x + 4 * height * x;
@smbss1
smbss1 / AIController.cs
Created July 19, 2022 05:07
Unity Utility Based AI Setup
using System.Collections.Generic;
using UnityEngine;
namespace UGPXFramework {
public class AIController {
private DynamicBlackboard _blackboard = new DynamicBlackboard();
private List<IAIScan> _scans = new List<IAIScan>();
private List<IAIAction> _actions = new List<IAIAction>();
public AIController(GameObject gameObject) {
@smbss1
smbss1 / ToonTerrain.cginc
Created January 24, 2023 01:40 — forked from probablyspoonie/ToonTerrain.cginc
Toon Terrain Tutorial
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
// Edits by Glynn Taylor. MIT license
// Includes code for splitmap by https://twitter.com/adamgryu and triplanar mapping by https://github.com/keijiro. MIT License
#ifndef TERRAIN_SPLATMAP_COMMON_CGINC_INCLUDED
#define TERRAIN_SPLATMAP_COMMON_CGINC_INCLUDED
struct Input
{
float3 localNormal : TEXCOORD0;
@smbss1
smbss1 / SaveClient.cs
Created March 17, 2023 08:16 — forked from Matthew-J-Spencer/SaveClient.cs
SaveClient.cs
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Unity.Services.CloudSave;
using UnityEngine;
public class CloudSaveClient : ISaveClient
{
private readonly ICloudSaveDataClient _client = CloudSaveService.Instance.Data;
Netcode package:
com.unity.netcode.gameobjects
Mutiplayer helpers (ClientNetworkTransform):
https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main
ParrelSync:
https://github.com/VeriorPies/ParrelSync.git?path=/ParrelSync
@smbss1
smbss1 / store.ts
Created May 20, 2024 07:25 — forked from serifcolakel/store.ts
Make global state management with useSyncExternalStore hook. Idea from Jotai. i'm calling jotai-clone for this approach. Finally, i'm try on my side project it works very well :)
/**
* full article about this gist
* @link https://blog.stackademic.com/building-a-state-management-system-with-react-86d382fa33cd
*/
import { useSyncExternalStore } from 'react';
/**
* @description An atom is a unit of state in Jotai. It is a container of a value that can be read synchronously and updated asynchronously.
*/
@smbss1
smbss1 / docker-compose.yml
Created June 22, 2024 15:53 — forked from Webreaper/docker-compose.yml
Sample Docker-compose file which shows how to set up Sonarr, Radarr, Prowlarr, Lidarr, QBittorrent and a VPN container so that all all traffic from the containers is routed through the VPN. Also includes Plex and get_iplayer containers, which are not routed through the VPN.
# Docker compose to set up containers for all services you need:
# VPN
# Sonarr, Radarr, Lidarr, Qbittorrent
# Non-VPN
# Plex, get_iplayer
# Before running docker-compose, you should pre-create all of the following folders.
# Folders for Docker State:
# /volume1/dockerdata. - root where this docker-compose.yml should live
# /volume1/dockerdata/plex - Plex config and DB
# /volume1/dockerdata/sonarr - Sonarr config and DB