Skip to content

Instantly share code, notes, and snippets.

View naelstrof's full-sized avatar
🤡

naelstrof naelstrof

🤡
View GitHub Profile
@naelstrof
naelstrof / GetLaunchVelocity.cs
Created August 12, 2021 08:42
Unity initial launch rigidbody velocity calculation
// A function that calculates the initial velocity of a rigidbody to hit the end point within the specified flight time.
// Rigidbody must have drag set to 0, otherwise it wont work.
// Classical projectile physics (dx = v0*t, dy = v0*t-0.5gt^2 type stuff)
private Vector3 GetLaunchVelocity(float flightTime, Vector3 startingPoint, Vector3 endPoint) {
Vector3 gravityNormal = Physics.gravity.normalized;
Vector3 dx = Vector3.ProjectOnPlane(endPoint, gravityNormal) - Vector3.ProjectOnPlane(startingPoint, gravityNormal);
Vector3 initialVelocityX = dx/flightTime;
Vector3 dy = Vector3.Project(endPoint, gravityNormal) - Vector3.Project(startingPoint, gravityNormal);
Vector3 g = 0.5f * Physics.gravity * (flightTime * flightTime);
/*
Copyright (c) 2018 Pete Michaud, github.com/PeteMichaud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@naelstrof
naelstrof / mixamoToBlenderBoneNames.py
Created September 7, 2018 20:57 — forked from eelstork/mixamoToBlenderBoneNames.py
Convert Mixamo rig bone names (as imported to Blender via FBX) to standard Blender bone names. This is especially use if your mesh uses the 'mirror' modifier. 1 - Backup your Blend. 2 - In action editor disconnect any animation connected to the rig. 3 - Paste the script in a text window and select "run script". 4 - Notice that all bone names are…
# IMPORTANT: make sure no animation is assigned
# to the rig before you run this script,
# otherwise linked animation data will be corrupted.
import bpy
# ----------------------------------
# Mixamo left/right bone names start with 'Left'/'Right'
# Instead we apply Blender's standard .L/.R suffix
# and get rid of long suffix
@naelstrof
naelstrof / CopyAvatarData.cs
Created April 8, 2018 23:07
Copies all avatar components and children to another object. Such as Dynamic Bones, Guns, Animations, etc.
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Text.RegularExpressions;
public class CopyAvatarData : ScriptableWizard {
public GameObject from;
public GameObject to;
@naelstrof
naelstrof / VRChatHelper.cs
Last active January 3, 2023 21:03
Tests your avatar in-editor from the VRChat SDK->Test Selected Avatars menu item.
// VRChatHelper.cs, a tool to help test your model without launching VRChat.
// Made by naelstrof (naelstrof@gmail.com)
// Some eye tracking advice to help prevent this tool from yelling at you: https://docs.google.com/document/d/1BvX_OdEilbJ7wEcvd5MRA1g29NGCAp3G3nHGp73t_CQ/edit?usp=sharing
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
@naelstrof
naelstrof / monitorshot2.sh
Last active February 22, 2023 18:35
Just screenshots the monitor that the mouse is on.
#!/bin/bash
MONITORS=$(xrandr | grep -o '[0-9]*x[0-9]*[+-][0-9]*[+-][0-9]*')
# Get the location of the mouse
XMOUSE=$(xdotool getmouselocation | awk -F "[: ]" '{print $2}')
YMOUSE=$(xdotool getmouselocation | awk -F "[: ]" '{print $4}')
for mon in ${MONITORS}; do
# Parse the geometry of the monitor
MONW=$(echo ${mon} | awk -F "[x+]" '{print $1}')
@naelstrof
naelstrof / monitorshot.sh
Last active February 23, 2023 17:22
This script intercepts specific user selections and replaces them with monitor geometry.
#!/bin/bash
# This script intercepts specific user selections and replaces them with monitor geometry.
# The specific user selection is when they click on the root window, or attempt to select the whole X screen.
# Currently there is a bug, clicking and dragging the entire screen will still proc the replacement,
# and only screenshot the monitor that the mouse is on after the drag. There's no way around this without
# changing slop to indicate when a user clicked or dragged. (Which might be done if people care enough.)
# Get a normal selection
read -r X Y W H G ID < <(slop -f "%x %y %w %h %g %i")
@naelstrof
naelstrof / catme.py
Created October 26, 2016 04:37
Brute forces a simple test on catme.com.
##
# @file catme.py
# @brief Quickly bruteforces a mind-numbing test on catme.org,
# # Install
# Requires python-selenium and python.
# # To Use
# Simply run the file through a python interpreter with the first argument being your catme email,
# and the second argument being your catme password. (eg. `python catme.py u08888888@utah.edu myPassword123`)
#
# @author Dalton "naelstrof" Nell
@naelstrof
naelstrof / goonstation-chems.json
Last active March 14, 2016 00:10
Just to make it easier to make a chemfuck compiler.
{
"reagents": [
{
"id": "booster_enzyme",
"mix_phrase": "The solution shows signs of life, forming shapes!",
"name": "Booster Enzyme",
"required_reagents": {
"carbon": 1,
"diethylamine": 1,
"ethanol": 1,
@naelstrof
naelstrof / s.sh
Created January 16, 2016 00:41
Imgur screenshooter
#!/bin/bash
if [ -d "~/Pictures" ]; then
mkdir -p ~/Pictures
fi
TIME=$(date +"%s")
maim -s --opengl --shader=hippie -n ~/Pictures/${TIME}.png
if [ $? == 1 ]; then
if [ -f /usr/share/sounds/freedesktop/stereo/dialog-error.oga ]; then
cvlc /usr/share/sounds/freedesktop/stereo/dialog-error.oga -q --play-and-exit
fi