Skip to content

Instantly share code, notes, and snippets.

View fand's full-sized avatar
💭
🔪

AMAGI / Jun Yuri fand

💭
🔪
View GitHub Profile
@fand
fand / main.rs
Last active January 18, 2024 00:20
Find emoji byte index in a String in Rust
extern crate unicode_segmentation;
use unicode_segmentation::UnicodeSegmentation;
use regex;
struct EmojiFinder {
re: regex::Regex,
}
impl EmojiFinder {
@fand
fand / nested_loop.frag
Created August 28, 2020 04:01
VEDA nested loop test
/*{
pixelRatio:0.5,
}*/
precision mediump float;
uniform float time;
uniform vec2 resolution;
#define PI 3.141593
vec2 rot(vec2 uv, float t) {
~ ❯ brew install deno
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/deno-1.0.0.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/db/db9f2a4dbacb6ce16a7264ca42c7daf8ace896d9a6e05f4a01f139abddc8c2b7?__gda__=exp=1589443285~hmac=81b0bd11f99f42b4007edad1b43452439d181a92cefc1acde754149da997614b&response-content-disposition=attachment%3Bfile
######################################################################## 100.0%
==> Pouring deno-1.0.0.mojave.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
@fand
fand / tcp2udp.js
Last active July 4, 2019 03:16
Forward TCP to UDP
#!/usr/bin/env node
const net = require('net');
const dgram = require('dgram');
if (process.argv.length !== 4) {
console.error(`
Usage:
node tcp2udp.js <TCP_SRC_PORT> <UDP_DST_PORT>
`);
process.exit(-1);
@fand
fand / DepthFader.hlsl
Created May 9, 2019 10:51
Unity Standard Surface Shader with Fade by Depth
Shader "Custom/DepthFade"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_DepthNear ("Depth Near", Range(0, 1000)) = 10
_DepthFar ("Depth Far", Range(0, 1000)) = 200
@fand
fand / SurfaceShadowCaster.hlsl
Created May 9, 2019 08:38
Transparent Standard Surface Shader with Depth
Shader "Custom/SurfaceShadowCaster"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_Cutout ("Cutout", Range(0, 1)) = 0.5
}
@fand
fand / Replicator.cs
Created April 11, 2019 07:40
Unity object replicator like blender's array modifier
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[ExecuteInEditMode]
public class Replicator : MonoBehaviour
{
[SerializeField] Transform _prefab;
[SerializeField, Range(1, 300)] int _count = 1;
@fand
fand / shit.frag
Created December 18, 2018 13:41
SHIT key effect on VEDA
/*{
IMPORTED: {
img: { PATH: 'shit.jpg' },
},
}*/
precision highp float;
uniform float time;
uniform vec2 resolution;
uniform sampler2D img;
@fand
fand / server.go
Created December 5, 2018 07:08
easy http server
package main
import (
"fmt"
"log"
"net/http"
"os"
"os/exec"
"path/filepath"
"runtime"