Skip to content

Instantly share code, notes, and snippets.

View iinfin's full-sized avatar

Han iinfin

View GitHub Profile
@iinfin
iinfin / resize_aspect_fit.py
Last active December 24, 2021 14:12
resize images in directory
# resize all images in a directory
from PIL import Image
import os
path = "D:/TMP/input/"
resize_ratio = 0.25
def resize_aspect_fit():
@iinfin
iinfin / overflow.md
Last active December 24, 2021 14:12
unix time
With 2^0 = 1 bit signed integers, Unix time will overflow on: 00:00:01 UTC January 01, 1970
With 2^0 = 1 bit unsigned integers, Unix time will overflow on: 00:00:02 UTC January 01, 1970

With 2^1 = 2 bit signed integers, Unix time will overflow on: 00:00:02 UTC January 01, 1970
With 2^1 = 2 bit unsigned integers, Unix time will overflow on: 00:00:04 UTC January 01, 1970

With 2^2 = 4 bit signed integers, Unix time will overflow on: 00:00:08 UTC January 01, 1970
With 2^2 = 4 bit unsigned integers, Unix time will overflow on: 00:00:16 UTC January 01, 1970
@iinfin
iinfin / git_io_custom_url.md
Last active December 24, 2021 14:13
git.io custom url
curl https://git.io/ -i -F "url=URL" -F "code=XXX"
  • https://*.github.com/*
  • https://*.github.io/*
  • https://*.githubusercontent.com/*
@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:

@iinfin
iinfin / houdini_attributes.md
Last active November 27, 2025 22:21
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 / 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 / .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 / 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 / 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);