Skip to content

Instantly share code, notes, and snippets.

View egemenertugrul's full-sized avatar

egemenertugrul

View GitHub Profile
@GorgeousOne
GorgeousOne / OrbitCamera.pde
Last active June 30, 2023 05:58
A blender like 3d orbiting camera for Processing. It enables rotation and movement in the scene with LMB and RMB
import java.awt.Toolkit;
/* Example Project
OrbitCamera cam;
void settings() {
size(1200, 800, P3D);
smooth();
}
void setup() {
cam = new OrbitCamera();
@bshishov
bshishov / forecasting_metrics.py
Last active July 19, 2024 18:17
Python Numpy functions for most common forecasting metrics
import numpy as np
EPSILON = 1e-10
def _error(actual: np.ndarray, predicted: np.ndarray):
""" Simple error """
return actual - predicted
@krzys-h
krzys-h / OpenVRManifest.cs
Last active February 15, 2021 17:34
[Unity] A script to handle creation and registration of OpenVR manifests in a Unity-friendly way
// A script to generate and register an OpenVR manifest in a Unity-friendly way
// OpenVR manifest lets you show proper app name in SteamVR status screen instead of process name, set a custom image for the loading screen in compositor or even allow to launch your game from Steam interface
// Feel free to do anything you want with this script, but please keep this copyright notice intact.
// https://gist.github.com/krzys-h/98464aa2f4a1ad814358f8f078111366
// Author: krzys_h, 2018-02-11
// Usage:
// Put this script anywhere in your assets folder
// Click Edit > Project Settings > OpenVR Manifest
// Fill in the settings
@cdata
cdata / three-clone-gltf.js
Created November 8, 2017 23:26
A quick hack to clone a Three.js GLTF scene without re-loading or re-parsing the source.
const cloneGltf = (gltf) => {
const clone = {
animations: gltf.animations,
scene: gltf.scene.clone(true)
};
const skinnedMeshes = {};
gltf.scene.traverse(node => {
if (node.isSkinnedMesh) {
@Prasad9
Prasad9 / add_gaussian_noise.py
Last active March 14, 2024 10:28
Python code to add random Gaussian noise on images
import cv2
def add_gaussian_noise(X_imgs):
gaussian_noise_imgs = []
row, col, _ = X_imgs[0].shape
# Gaussian distribution parameters
mean = 0
var = 0.1
sigma = var ** 0.5
from vjoy import vj, setJoy
import numpy as np
import time
print("vj opening", flush=True)
vj.open()
time.sleep(1)
@ms5
ms5 / verbos-argpary-example.py
Last active July 19, 2024 12:19
manipulating log level with python argparse
import argparse
import logging
parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', action='count', default=1)
args = parser.parse_args()
args.verbose = 70 - (10*args.verbose) if args.verbose > 0 else 0
logging.basicConfig(level=args.verbose, format='%(asctime)s %(levelname)s: %(message)s',
@RyanNielson
RyanNielson / TrackTargets.cs
Created March 30, 2014 20:15
A orthographic camera script for Unity that keeps all targets in frame by adjusting orthographic size and camera position.
using UnityEngine;
public class TrackTargets : MonoBehaviour {
[SerializeField]
Transform[] targets;
[SerializeField]
float boundingBoxPadding = 2f;
@frarees
frarees / MinMaxSliderAttribute.cs
Last active July 8, 2024 17:26
MinMaxSlider for Unity
// https://frarees.github.io/default-gist-license
using System;
using UnityEngine;
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class MinMaxSliderAttribute : PropertyAttribute
{
public float Min { get; set; }
public float Max { get; set; }