Skip to content

Instantly share code, notes, and snippets.

View badjano's full-sized avatar
💭
unity + python + c++

Badjano badjano

💭
unity + python + c++
View GitHub Profile
@badjano
badjano / quaternion_functions.shader
Created August 7, 2018 02:26
Quaternion GLSL functions
float4 qmul(float4 q1, float4 q2)
{
return float4(
q2.xyz * q1.w + q1.xyz * q2.w + cross(q1.xyz, q2.xyz),
q1.w * q2.w - dot(q1.xyz, q2.xyz)
);
}
float3 rotate_vector(float4 r, float3 v) {
import requests
def generate_ppo(symbol="NEO", short=16, long=18, signal=9, persistence=2):
return {
"gekkoConfig": {
"watch": {
"exchange": "binance",
"currency": "BTC",
"asset": symbol
@badjano
badjano / parallel_test.py
Created January 9, 2018 19:47
Simple example of threading using all cpu threads available
from threading import Thread, Lock
from multiprocessing import cpu_count
from queue import Queue
import math
import random
lock = Lock()
def do_work(name, t):
@badjano
badjano / bezier_interpolator.cs
Last active August 25, 2017 22:06
Bezier Interpolator
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
[ExecuteInEditMode]
public class CurveTrackGenerator : MonoBehaviour
{
[SerializeField] private Color _color;
[SerializeField, Range(1f, 10f)] private float _momentum = 3;
@badjano
badjano / audio_gen.py
Last active January 7, 2019 08:11
Generating, playing and saving audio
import wave
import numpy as np
import pyaudio
p = pyaudio.PyAudio()
volume = 0.5 # range [0.0, 1.0]
fs = 44100 # sampling rate, Hz, must be integer
duration = 2.0 # in seconds, may be float
f = 440.0 # sine frequency, Hz, may be float