Skip to content

Instantly share code, notes, and snippets.

View egemenertugrul's full-sized avatar

egemenertugrul

View GitHub Profile
@jbgo
jbgo / git-recover-branch.md
Last active May 23, 2024 12:29
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@lebedov
lebedov / multi_bidi_pyzmq_demo.py
Created April 17, 2012 21:27
Bidirectional communication between two processes with pyzmq
#!/usr/bin/env python
"""
Bidirectional communication between two processes.
"""
import numpy as np
import zmq
import multiprocessing as mp
@strezh
strezh / GStreamer-1.0 some strings.sh
Last active October 2, 2023 09:00
GStreamer-1.0 personal cheat sheet
#!/bin/bash
# play YUV444 FULL HD file
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \
videoparse width=1920 height=1080 framerate=25/1 format=GST_VIDEO_FORMAT_Y444 ! \
videoconvert ! \
autovideosink
# play YUV422 FULL HD file
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \
@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; }
@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;
@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',
from vjoy import vj, setJoy
import numpy as np
import time
print("vj opening", flush=True)
vj.open()
time.sleep(1)
@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
@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) {
@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