Skip to content

Instantly share code, notes, and snippets.

View prnthp's full-sized avatar
👣
i write code when i'm annoyed at things

Pornthep Preechayasomboon prnthp

👣
i write code when i'm annoyed at things
View GitHub Profile
@prnthp
prnthp / OneGrabKnobTransformer.cs
Last active January 4, 2023 14:24
Transformer for on axis rotations such as knobs. It is better than OneGrabRotateTransformer for this use case.
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
@prnthp
prnthp / OneGrabRotateTransformer.cs
Last active May 29, 2022 23:46
Improved OneGrabRotateTransformer
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
@prnthp
prnthp / Helvetica-Neue.xml
Last active October 19, 2021 18:17
Helvetica Neue font theme for PowerPoint for macOS. Put this in ~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Themes.localized/Theme Fonts
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<a:fontScheme name="Helvetica Neue" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:majorFont>
<a:latin typeface="Helvetica Neue" />
<a:ea typeface="" />
<a:cs typeface="" />
<a:font script="Jpan" typeface="MS Pゴシック"/>
<a:font script="Hang" typeface="굴림"/>
<a:font script="Hans" typeface="黑体"/>
<a:font script="Hant" typeface="微軟正黑體"/>
@prnthp
prnthp / AWSUploadAsync.cs
Last active August 3, 2021 02:27
Super simple way to queue up files to be uploaded to your S3 bucket in Unity without relying on the AWS .NET APIs
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Threading;
using System.Security.Cryptography;
using System.Text;
using UnityEngine;
public class AWSUploadAsync : MonoBehaviour
@prnthp
prnthp / DAQmxErrorWarningCodes.md
Created October 18, 2020 05:16
DAQmx Error & Warning Codes
Error Code
DAQmxErrorMultiTaskCfgSampRateNotSupportedWithPropSet -209886
DAQmxErrorMultiTaskCfgSampRateConflictingProp -209885
DAQmxErrorNoCommonSampRateFoundNoRepeatSamps -209884
DAQmxErrorNoCommonSampRateFound -209883
DAQmxErrorMultiTaskCfgDoesNotSupportMultiDevTask -209882
DAQmxErrorMultiTaskSampRateCfgNotSupported -209881
DAQmxErrorDebugSessionNotAllowedTimingSourceRegistered -209880
DAQmxErrorDebugSessionNotAllowedWhenLogging -209879
@prnthp
prnthp / ezi2c_modustoolbox.md
Last active June 10, 2020 03:06
Minimum example for setting up I2C Slave using EZI2C on ModusToolbox

How to setup EZI2C Slave with Cypress ModusToolbox for PSOC6

Finally we can develop PSOC on *nix and macOS! But Cypress' documentation sucks. With PSOC Creator, you could just drag some components around and the codegen worked perfectly - then only a few lines of code were required to get EZI2C working. Now it's this crap.

You actually don't have to do all of that!

This guide assumes you have a bit of knowledge of both PSOC Creator and ModusToolbox, and I2C.

Device Configurator: Peripherals Plane

Device Configurator Window EZI2C is one of the components of the Serial Communication Block (SCB). Each SCB has its own set of SDA/SCL pins. Here, we're using the P6.4 and P6.5 pins for the CY8CPROTO-63-BLE that is already connected to the KitProg's I2C bus, so we need SCB 6. How do we know whi

@prnthp
prnthp / Images.md
Created June 10, 2020 01:50
Images

Collection of images for gists

@prnthp
prnthp / pretty_matlab_figures.md
Created March 2, 2020 03:38
How to generate and save vector figures in MATLAB

How to generate and save vector figures in MATLAB

This is how I generate .eps/.pdf/.png files for publications. This will produce nice vector figures and rasters at a nice crispy 300 DPI

Add this to the top of your script

fontname = 'Arial'; % or your favorite font, IEEE prefers Arial in figures. Helvetica is also sexy.
set(0,'DefaultAxesFontName',fontname,'DefaultTextFontName',fontname);
set(0,'DefaultAxesFontSize',8);
@prnthp
prnthp / Colors.cs
Last active June 10, 2020 02:16 — forked from ZsemberiDaniel/Colors
I heard you needed colors
using System;
using System.Reflection;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public static class Colors
{