Skip to content

Instantly share code, notes, and snippets.

View kumorikuma's full-sized avatar

Francis Ge kumorikuma

View GitHub Profile
@kumorikuma
kumorikuma / WSL_port_forward.sh
Created May 11, 2023 23:42
Forward traffic on a port that goes to localhost, to go to WSL instead.
#!/bin/bash
# Check if the first positional parameter is empty
if [ -z "$1" ]; then
# Assign a default value if the parameter is empty
listenport=7000
else
listenport=$1
fi
@kumorikuma
kumorikuma / .gitattributes
Created February 16, 2023 08:24
Unity .gitattributes file configured for LFS
## Unity ##
# See https://docs.unity3d.com/Manual/SmartMerge.html
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
## git-lfs ##
#Image
*.jpg filter=lfs diff=lfs merge=lfs -text
@kumorikuma
kumorikuma / pre-push.sh
Last active February 5, 2024 23:24
pre-push hook for Git LFS enabled projects that prevents any big files from being accidentally pushed and can automatically add them to Git LFS
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/pre-push'.\n"; exit 2; }
git lfs pre-push "$@"
# This pre-push hook will check any non git-lfs tracked files that are about to be pushed and make sure they are not too big.
# Big files can be migrated to LFS using [git lfs migrate]
#
# To enable this hook, rename this file to "pre-push".
# It should be installed to a path like "[Reponame]/.git/hooks/pre-push".
@kumorikuma
kumorikuma / git_quickref.md
Last active July 9, 2023 06:28
[WIP] Git Quick Reference

Setting up Authentication

Generate an ssh key: ssh-keygen -C "username@example.com"
SSH Key will be generated at: "~/.ssh"
Copy contents of public key then upload it to Git hosting service: cat ~/.ssh/id_rsa.pub
Start up the SSH agent which supplies Git with the credentials: eval "$(ssh-agent -s)"
Add the private key to the SSH agent: ssh-add ~/.ssh/id_rsa

Initializing repository

@kumorikuma
kumorikuma / autotranslate_hardsubs.py
Last active April 19, 2024 16:32
Takes as input a video with hardsubs, and will generate translated softsubs in the target language
# Requirements:
# - ImageMagick binary
# - Windows.Media.Ocr.Cli binary
# - VideoSubFinder binary
#
# Official GCloud Translate Setup:
# First 500k characters / mo is free: https://cloud.google.com/translate/pricing
# Install Python Module: pip install google-cloud-translate
# Setup Google Cloud account and billing information: https://cloud.google.com/
# Make a new project and enable "Cloud Translation API": https://console.cloud.google.com/apis/dashboard
@kumorikuma
kumorikuma / install_chrome_driver.sh
Last active January 27, 2023 06:40
Environment setup for running an automated headless Chrome browser on Ubuntu
# Install Chrome, ChromeDriver, and Selenium WebDriver.
# ChromeDriver provides an API to control Chrome, and WebDriver facilitates making automated scripts.
# References:
# https://gist.github.com/ziadoz/3e8ab7e944d02fe872c3454d17af31a5
# https://towardsdatascience.com/how-to-setup-selenium-on-a-linux-vm-cd19ee47d922
# Install Java dependencies for Selenium:
sudo apt-get update
sudo apt-get install -y unzip openjdk-8-jre-headless xvfb libxi6 libgconf-2-4