Skip to content

Instantly share code, notes, and snippets.

View yzAlvin's full-sized avatar

Alvin Zhao yzAlvin

View GitHub Profile
@yzAlvin
yzAlvin / epub_to_mobi
Created July 5, 2023 10:06
Windows Powershell script to quickly rename epubs to mobis
$sourceFolder = "E:\path\to\folder"
$epubs = Get-ChildItem -Path $sourceFolder -Filter "*.epub"
foreach ($epub in $epubs) {
$destination = Join-Path -Path $sourceFolder -ChildPath ($epub.BaseName + ".mobi")
Copy-Item -Path $epub.FullName -Destination $destination
}
@yzAlvin
yzAlvin / git log
Last active November 29, 2022 23:24
git commits since
git log <hash>.. --oneline //HEAD is implicit
git log --after="2014-02-12T16:36:00-07:00"
git log --before="2014-02-12T16:36:00-07:00"
git log --since="1 month ago"
git log --since="2 weeks 3 days 2 hours 30 minutes 59 seconds ago"
git log --merges --first-parent main \
--pretty=format:"%h %<(10,trunc)%aN %C(white)%<(15)%ar%Creset %C(red bold)%<(15)%D%Creset %s"
@yzAlvin
yzAlvin / slipy_slidy_playlist_scraper.py
Created May 9, 2022 13:07
SlipySlidy Playlist Scraper
import re
from pytube import Playlist
from pytube import YouTube
import jsonpickle
from dataclasses import dataclass
@dataclass
class Metadata:
albumArtist: str
artist: str
@yzAlvin
yzAlvin / gcp-dependabot.sh
Last active April 4, 2022 06:29
Cherry-pick dependabot
git branch -r | grep 'origin/dependabot/' | while read -r branch ; do git cherry-pick $(git rev-parse $branch) ; done
@yzAlvin
yzAlvin / git-repo-cli
Created March 10, 2021 23:00
Create new git repo on cli
##Initialise new repository on the command line
vi README.md
git init
git add README.md
git commit -m "Initial commit"
git remote add origin git@github.com:<org/user>/<reponame>.git
git push -u origin master