Skip to content

Instantly share code, notes, and snippets.

@cmdr2
cmdr2 / GenerateMesh02.cs
Last active November 1, 2023 14:28
A mesh extrusion along a bezier curve (Unity3d)
[RequireComponent(typeof(MeshFilter))]
public class GenerateMesh02 : MonoBehaviour {
/* scratchpad */
private MeshFilter mf;
void Start () {
mf = GetComponent<MeshFilter> ();
GenerateMesh ();
@keithcollins
keithcollins / AStarSearch.cs
Created August 30, 2016 23:45
A* pathfinding implementation for Unity 5, C#
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
// This script is adapted from these,
// but has been heavily modified in some areas:
// http://www.redblobgames.com/pathfinding/a-star/implementation.html#csharp
// https://gist.github.com/DanBrooker/1f8855367ae4add40792
// I'm continuing to optimize and change things here. I would not use this
@barosl
barosl / add.c
Created July 26, 2015 07:26
Function overloading in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int addi(int a, int b) {
return a + b;
}
char *adds(char *a, char *b) {
char *res = malloc(strlen(a) + strlen(b) + 1);
anonymous
anonymous / gist:9924932
Created April 1, 2014 23:08
%% Read image and convert to grayscale
img = imread('pic.jpg');
img = rgb2gray(img);
%% Define grayscale representations of 0-255
chars = fliplr([' ', '.', ',', ':', '-', '=', '+', '*', '#', '%', '@']);
step = 256 / 11;
%% Cut image so its size is 8*w times 13*h
imgSize = size(img);
@utek
utek / Exclude_tables.md
Last active October 13, 2023 16:07
Define ignored tables in alembic.ini

Add this in your ini file:

[alembic:exclude]
tables = spatial_ref_sys

In env.py:

    import re 
    
@eXpl0it3r
eXpl0it3r / Stroke.cpp
Created July 22, 2013 20:13
Stroke - A dirty port to SFML 2.0
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include "Stroke.hpp"
#include <SFML/OpenGL.hpp>
const float myRand(float low, float high)
{
return static_cast<float>(std::rand()) / RAND_MAX * (high - low) + low;
@mminer
mminer / Console.cs
Last active March 28, 2024 22:23
Unity script to display in-game debug console. Actively maintained version: https://github.com/mminer/consolation
// NOTE: For an actively-maintained version of this script, see https://github.com/mminer/consolation.
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// A console to display Unity's debug logs in-game.
/// </summary>
public class Console : MonoBehaviour
{
/*
The MIT License (MIT)
Copyright (c) 2014 Ismael Celis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is