Skip to content

Instantly share code, notes, and snippets.

View howyay's full-sized avatar
🏠
Working from home

howyay

🏠
Working from home
  • Hunan, China & NY, US
View GitHub Profile
/* Center of Gravity Finder
This script will find the center of gravity (centroid) of all closed paths in the selection set. It was built for a specific purpose so does not have much error
handling. For example, if you get errors it may be the result of the selection set containing compound shapes or a self-intersecting polygon.
References for the math:
http://paulbourke.net/geometry/polygonmesh/ (Calculating the area and centroid of a polygon)
https://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon
Save this file with a jsx extension and place in your Illustrator/Presets/en_US/Scripts folder. You can then access it from the File > Scripts menu
@howyay
howyay / worker.js
Last active April 6, 2020 15:16 — forked from tobiaslins/worker.js
Notion.so Custom Domain + Inline LaTeX Rendering
const MY_DOMAIN = "YOUR_DOMAIN"
const START_PAGE = "URL_TO_NOTION_LANDING_PAGE"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, HEAD, POST,PUT, OPTIONS",
@howyay
howyay / FlarumSetupGuide(Updated as of 20190324).md
Last active March 25, 2019 03:57
This is an updated version to my old flarum setup guide on Ubuntu, now updated to php7.3 and removed some unrelated stuff

Flarum Setup Guide on Ubuntu 18.04 (PHP7.3)

Before we start, you have to create a non root user and switch over to that user

Then

sudo apt update && sudo apt upgrade -y
@howyay
howyay / nvidia-xrun指南.md
Created March 11, 2019 03:13
安装及配置nvidia-xrun的指南

nvidia-xrun安装及配置指南

此选项允许在arch内临时运行独显,只建议linux单系统/用linux玩游戏使用

 pacman -S nvidia-dkms //如果安装了自定义内核需要安装dkms版nvidia驱动
 yay -S nvidia-xrun-git

重启

@howyay
howyay / Setting up Postfix on Debian.md
Last active April 23, 2024 11:54
A guide to set up a Postfix + Dovecot IMAP server with complete spf, dkim and dmarc support.

An ultimate guide to Postfix + Dovecot IMAP server with complete SPF, DKIM and DMARC support and additional instructions for a multi-domain setup

In this guide, domain.com will be your root domain and mail.domain.com will be the hostname of your mail server

@howyay
howyay / 太极·Magisk 不完全漫游指北.md
Created January 24, 2019 02:17
太极·Magisk 不完全漫游指北

太极·Magisk 不完全漫游指北

MoonBegonia on January 22, 2019

ENGLISH GUIDE

太极·Magisk 今天开启了大规模内测,只需要填写问卷即可参加,在这里整理相关内容。

请仔细查看文档。刷机有风险,操作需谨慎;手机有价,数据无价。

The Hitchhiker's Guide to Magisk Taichi

中文指南

Please read through the documentations carefully. Modding can be risky, proceed with extreme caution. The hardware can be valued where as the data are priceless.

See resources at the end of this document

Presequites

@howyay
howyay / FlarumSetupGuide(Outdated).md
Last active March 25, 2019 01:37
A setup guide to Flarum using Apache(and Apache only!) on Ubuntu 18.04 (This is outdated, stop referring to it)

Flarum Setup Guide

Add non-root user to ensure safety in production environment:

adduser username
usermod -aG sudo username
su - username