Skip to content

Instantly share code, notes, and snippets.

View theawless's full-sized avatar

Abhinav Singh theawless

View GitHub Profile
@theawless
theawless / dining_philosophers.c
Last active November 8, 2022 20:55
A solution to The Dining Philosophers problem in C using locks. Ensures non starvation and mutual exclusion.
#include<stdio.h>
#include<pthread.h>
#include<stdlib.h>
#include<unistd.h>
#define MAX_MEALS 50
#define MAX_WAIT_TIME 3000000
#define NUMBER_OF_PHILOSOPHERS 7
#define WORK_TIME 3
@theawless
theawless / PlaneCamera.cs
Last active December 30, 2016 20:37
Useful for fighting games like Mortal Kombat, Street Fighters, Tekken. This camera looks at the plane created by the line joining the two targets and vertical up
using UnityEngine;
namespace Assets.Standard_Assets.Cameras.Scripts
{
// Useful for fighting games like Mortal Kombat, Street Fighters, Tekken
// This camera looks at the plane created by the line joining the two targets and vertical up
public class PlaneCamera : MonoBehaviour
{
[SerializeField]
private bool autoTarget = false;