Skip to content

Instantly share code, notes, and snippets.

View iinfin's full-sized avatar

Han iinfin

View GitHub Profile
@iinfin
iinfin / clear_windows_updates.bat
Created April 29, 2022 07:25
clear windows updates
@echo off
powershell -windowstyle hidden -command "Start-Process cmd -ArgumentList '/s,/c,net stop usosvc & net stop wuauserv & del %systemroot%\SoftwareDistribution\DataStore\Logs\edb.log & del /f /q C:\ProgramData\USOPrivate\UpdateStore\* & net start usosvc & net start wuauserv & UsoClient.exe RefreshSettings' -Verb runAs"
@iinfin
iinfin / index.html
Created April 28, 2022 14:19
unity-webgl-template
<!-- https://docs.unity3d.com/Manual/webgl-templates.html -->
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{{{ PRODUCT_NAME }}}</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/normalize.css/normalize.min.css" />
@iinfin
iinfin / cubic-bezier.js
Last active April 28, 2022 14:20
cubic bezier easing
// simplified version of:
// https://github.com/gre/bezier-easing/blob/master/src/index.js
// https://npmjs.com/package/bezier-easing
function slopeFromT(t, A, B, C) {
return 1.0 / (3.0 * A * t * t + 2.0 * B * t + C);
}
function xFromT(t, A, B, C, D) {
return A * (t * t * t) + B * (t * t) + C * t + D;
@iinfin
iinfin / cf-auth.js
Created February 10, 2022 19:45
cloudflare password protection per site using values from KV
const _REALM = 'Secure Area';
const _DEFAULT_USERNAME = 'username';
const _DEFAULT_PASSWORD = null;
addEventListener('fetch', (event) => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const password = await getValidCredentials(request);
@iinfin
iinfin / netlify.sh
Last active January 12, 2022 09:13
netlify rust installation for web projects
#!/usr/bin/env bash
# curl https://gist_raw_url -sSLf | bash
set -e
cweb_version=0.6.26
cweb=https://github.com/koute/cargo-web/releases/download/$cweb_version/cargo-web-x86_64-unknown-linux-gnu.gz
curl -Lo cargo-web.gz $cweb
gunzip cargo-web.gz
@iinfin
iinfin / .perforce.sh
Last active January 12, 2022 14:26
perforce helix server on macos
#!/bin/sh
CURRENT_DIR=$(pwd)
DOWNLOAD_URL="https://www.perforce.com/downloads/perforce/r21.2/bin.macosx1015x86_64/helix-core-server.tgz"
DOWNLOAD_DIR="${CURRENT_DIR}/tmp_perforce_download/"
sudo rm -rf "${DOWNLOAD_DIR}"
sudo mkdir "${DOWNLOAD_DIR}"
@iinfin
iinfin / houdini_octane_tile_render.py
Last active December 24, 2021 14:02
generate render tiles
import hou
import os
def fit(input, oldmin, oldmax, newmin, newmax):
return (((input - oldmin) * (newmax - newmin)) / (oldmax - oldmin)) + newmin
def tile_camera(path_cam, path_rop, tiles_x=2, tiles_y=2):
debug = False
@iinfin
iinfin / houdini_attributes.md
Last active October 27, 2025 13:19
houdini attributes cheatsheet

https://mrkunz.com/blog/08_22_2018_VEX_Wrangle_Cheat_Sheet.html

f@Frame The current floating frame number, equivalent to the $FF Hscript variable
f@Time The current time in seconds, equivalent to the $T Hscript variable
i@SimFrame The integer simulation timestep number ($SF), only present in DOP contexts
f@SimTime The simulation time in seconds ($ST), only present in DOP contexts
f@TimeInc The timestep currently being used for simulation or playback
- -
@iinfin
iinfin / openssl.md
Last active December 24, 2021 14:05
local host https certificate

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

Certificate authority (CA)

Generate root.pem, root.key & root.crt: