Skip to content

Instantly share code, notes, and snippets.

View FradSer's full-sized avatar
🎯
Focusing

Frad LEE FradSer

🎯
Focusing
View GitHub Profile
@FradSer
FradSer / .cursorrules
Last active February 19, 2025 14:24
.cursorrules and .cursor/rules for SwiftUI Project
- Follow the user's requirements exactly as provided.
- Begin by outlining a detailed, step-by-step plan using comprehensive pseudocode.
- Once the plan is confirmed, proceed to write the code.
- Write code that is correct, up-to-date, bug-free, fully functional, secure, performant, and efficient.
- Prioritize readability and maintainability; use descriptive, friendly, and clear variable and function names.
- Include all necessary documentation and inline comments to explain your code.
- Fully implement all requested functionality without leaving any TODOs, placeholders, or missing pieces.
- Be concise and minimize any extraneous prose.
- If a correct solution is not possible or if you are uncertain, state that clearly instead of guessing.
@FradSer
FradSer / create-nuclear-hexagrams.ts
Created January 2, 2025 09:39
Generates a Nuclear Hexagram (互卦 / Hu Gua) from the provided original hexagram.
/**
* Generates a Nuclear Hexagram (互卦 / Hu Gua) from the provided original hexagram.
*
* The Nuclear Hexagram is a combination of two trigrams,
* the Upper Trigram (上卦 / Shang Gua) and the Lower Trigram (下卦 / Xia Gua):
* - The Upper Trigram is formed by extracting the third, fourth,
* and fifth lines from the original hexagram.
* - Conversely, the Lower Trigram is formed by extracting the second, third,
* and fourth lines from the original hexagram.
*
@FradSer
FradSer / 75_-Alice-Layout-by-Frad.kbd.json
Last active September 22, 2024 13:39
75% Alice Layout by Frad
[
{
"name": "75% Alice Layout by Frad",
"author": "Frad LEE",
"switchMount": "cherry"
},
[
{
"x": 1.45,
"a": 7
export PATH="/opt/homebrew/bin:$PATH" # Setup Homebrew
eval "$(starship init zsh)" # Setup starship
source $HOME/.config/dotflies/*.zsh # Setup custom dotfiles
# Download Znap, if it's not there yet.
[[ -f $HOME/.znap/zsh-snap/znap.zsh ]] ||
git clone --depth 1 -- \
https://github.com/marlonrichert/zsh-snap.git $HOME/.znap/zsh-snap
# /bin/bash
echo "Removing Oculus folder..."
rm -rf ./Assets/Oculus ./Assets/Oculus.meta
echo "Removing files named with oculus, OVR, AndroidManifest, vrapi, vrlib, vrplatlib..."
find . -name "oculus" -exec rm -rf {} \;
find . -name "OVR" -exec rm -rf {} \;
find . -name "AndroidManifest" -exec rm -rf {} \;
find . -name "vrapi" -exec rm -rf {} \;
find . -name "vrlib" -exec rm -rf {} \;
# Created by https://www.toptal.com/developers/gitignore/api/macos,unity
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,unity
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
@FradSer
FradSer / pre-upgrade.sh
Last active April 28, 2022 07:53
Remove old Oculus Integration
# /bin/bash
echo "Removing Oculus folder..."
rm -rf ./Assets/Oculus ./Assets/Oculus.meta
echo "Removing files named with oculus, OVR, AndroidManifest, vrapi, vrlib, vrplatlib..."
find . -name "oculus" -exec rm -rf {} \;
find . -name "OVR" -exec rm -rf {} \;
find . -name "AndroidManifest" -exec rm -rf {} \;
find . -name "vrapi" -exec rm -rf {} \;
find . -name "vrlib" -exec rm -rf {} \;
@FradSer
FradSer / vc.py
Created January 6, 2022 17:17
Vision Center
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.patches as patches
import matplotlib.text as text
def rgb2gray(rgb):
return np.dot(rgb[...,:3], [0.2989, 0.5870, 0.1140])
@FradSer
FradSer / LongPressButton.swift
Created November 28, 2021 08:49
A iOS flashlight like button in SwiftUI.
//
// LongPressButton.swift
// Pachino
//
// Created by Frad LEE on 6/28/21.
//
import SwiftUI
// MARK: - LongPressButton
@FradSer
FradSer / gifify.zsh
Last active July 26, 2021 09:55
Video to gif with ffmpeg.
function gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 1200x1200\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -vf scale=1200:-1 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else