Skip to content

Instantly share code, notes, and snippets.

View fand's full-sized avatar
💭
🔪

AMAGI / Jun Yuri fand

💭
🔪
View GitHub Profile
@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 / npmenv
Last active May 20, 2019 05:53
npmenv
#!/bin/bash
# .npmを作成
if [ ! -e .npm ]; then
mkdir .npm
fi
# npm本体をインストール
NPM_VERSION=$(echo $1 || cat .npm-version || npm -v)
if [ ! NPM_VERSION = $(npm -v) ]; then
@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 / 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"
/*{ "osc": 4000 }*/
precision mediump float;
uniform float time;
uniform vec2 resolution;
uniform sampler2D backbuffer;
uniform sampler2D osc_tidal;
vec2 rotate(in vec2 p, in float t) {
return mat2(cos(t), -sin(t), sin(t), cos(t)) * p;
}
float random(in vec2 st) {
@fand
fand / foo.tidal
Created April 6, 2018 12:29
tidal midi test
import Sound.Tidal.MIDI.Context
import Sound.Tidal.MIDI.Control
import Sound.Tidal.MIDI.CC
devices <- midiDevices
m1 <- midiStream devices "" 1 synthController
m1 $ midinote "60*4 62*4 64*2 65*4"
m1 $ silence
@fand
fand / remark-strip-html-but-iframe.js
Created March 5, 2018 10:10
remark-strip-html-but-iframe.js
// iframe以外のHTML文字列を禁止する。
// remark-strip-htmlを参考にした。
const IS_ATTR_ALLOWED = {
src: true,
frameborder: true,
height: true,
width: true,
};