Skip to content

Instantly share code, notes, and snippets.

@robertwtucker
robertwtucker / unix-timestamp.js
Last active July 13, 2023 17:21
Generate a Unix timestamp
const urlencoded = new URLSearchParams()
urlencoded.append(
'timestamp',
Math.floor(new Date().getTime() / 1000).toString()
)
@robertwtucker
robertwtucker / git-mv-with-history.sh
Created January 27, 2022 07:14
Move Git Files with History Preservation
mkdir ~/dirswap && cd ~/dirswap
git clone repo1.git && cd repo1
# My use case: repo1/chart -> repo2/appname (mv < migration)
mv chart appname
git commit -am "chore: migrating helm chart to charts repo"
git filter-repo --path-rename chart/:appname/ --force
mkdir /tmp/mergepatches
export REPOSRC=appname # (or srcfile.go if moving a file)
git format-patch -o /tmp/mergepatches $(git log $REPOSRC|grep ^commit|tail -1|awk '{print $2}')^..HEAD $REPOSRC
cd ~/dirswap

Keybase proof

I hereby claim:

  • I am robertwtucker on github.
  • I am robertwtucker (https://keybase.io/robertwtucker) on keybase.
  • I have a public key ASCxfQMcEAOVT8EGr5MYFI_wOYb-XZTICWJZin-i8UeNIwo

To claim this, I am signing this object: