Skip to content

Instantly share code, notes, and snippets.

View egemenertugrul's full-sized avatar

egemenertugrul

View GitHub Profile
# listen.py
from threading import Thread
import socket
import time
import sys
VERBOSE = False # Enables/Disables printing of debug messages
IP_PORT = 22000 # the port that tinkerboard listens to
TIME_INTERVAL = 10 # sec
@egemenertugrul
egemenertugrul / binvox_rw.py
Last active January 17, 2020 08:05
binvox_rw.py modified for Python 3.6
# Copyright (C) 2012 Daniel Maturana
# This file is part of binvox-rw-py.
#
# binvox-rw-py is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# binvox-rw-py is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@egemenertugrul
egemenertugrul / ResourcesExtension.cs
Last active January 3, 2023 09:14
StreamingAssets/Resources Extensions for Unity
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public static class ResourcesExtension
{
/// <summary>
/// Recursively traverses each folder under <paramref name="path"/> and returns the list of file paths.
/// It will only work in Editor mode.
/// </summary>
@egemenertugrul
egemenertugrul / DynamicPlots.py
Last active November 7, 2022 11:39
Matplotlib Dynamic Multiple Subplots
import math
from matplotlib import pyplot as plt
plt.ion()
class AxesWrapper:
def __init__(self, lines, ax, max_display_capacity=None):
self.lines = lines
@egemenertugrul
egemenertugrul / full_duplex_server.py
Last active August 10, 2023 18:00
Python Websockets Full Duplex Asynchronous Multiprocessing Server
import asyncio
import multiprocessing as mp
from websockets.server import serve
from websockets.exceptions import ConnectionClosedOK
import time
class DuplexWebsocketsServerProcess(mp.Process):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._send_queue = mp.Queue()
@egemenertugrul
egemenertugrul / RemapUnit.cs
Created December 4, 2024 09:07
Remap Unit for Unity Visual Scripting
using UnityEngine;
using Unity.VisualScripting;
public static class MathExtensions
{
public static float Remap(this float value, float fromMin, float fromMax, float toMin, float toMax, bool isClamped = false)
{
return isClamped
? Mathf.Clamp01((value - fromMin) / (fromMax - fromMin)) * (toMax - toMin) + toMin
: (value - fromMin) / (fromMax - fromMin) * (toMax - toMin) + toMin;