Skip to content

Instantly share code, notes, and snippets.

View Hotrian's full-sized avatar
💭
Coding!

Nicholas Ewalt Hotrian

💭
Coding!
View GitHub Profile
@zerda
zerda / Program.cs
Created July 30, 2019 16:25
Convert an RSA to JsonWebKey format
// nuget package reference with:
// - System.IdentityModel.Tokens.Jwt
using System;
using System.Security.Cryptography;
using Newtonsoft.Json;
using Microsoft.IdentityModel.Tokens;
static void Main(string[] args) {
var provider = new RSACryptoServiceProvider(2048);
var key = new RsaSecurityKey(provider.ExportParameters(true));
@tntmeijs
tntmeijs / unitythreedimensionalperlinnoise.cs
Last active February 19, 2024 01:52
A 3D implementation using the 2D Perlin noise function of Unity3D.
public static float Noise3D(float x, float y, float z, float frequency, float amplitude, float persistence, int octave, int seed)
{
float noise = 0.0f;
for (int i = 0; i < octave; ++i)
{
// Get all permutations of noise for each individual axis
float noiseXY = Mathf.PerlinNoise(x * frequency + seed, y * frequency + seed) * amplitude;
float noiseXZ = Mathf.PerlinNoise(x * frequency + seed, z * frequency + seed) * amplitude;
float noiseYZ = Mathf.PerlinNoise(y * frequency + seed, z * frequency + seed) * amplitude;