Skip to content

Instantly share code, notes, and snippets.

View chadly's full-sized avatar

Chad Lee chadly

View GitHub Profile
@chadly
chadly / .gitconfig
Last active August 26, 2022 15:06
Setup global git configuration
[core]
editor = code --wait
[user]
name = Chad Lee
email = git@chadly.net
[pull]
rebase = true
[push]
default = upstream
@chadly
chadly / delete-build-tags.sh
Last active August 29, 2015 14:02
Deletes remote and local git tags that match the format v1.0.0+123
#!/bin/bash
#http://blog.siyelo.com/how-to-bulk-delete-remote-git-tags/
git ls-remote --tags origin | awk '/^(.*)(\s+)(.*\+[0-9]+)$/ {print ":" $2}' | xargs git push origin
git tag -l | awk '/^(.*\+[0-9]+)$/ {print $1}' | xargs git tag -d
@chadly
chadly / history-rewrite.sh
Last active August 29, 2015 14:05
Merge prop components back to civicsource
#!/bin/bash
PREFIX=src/CivicSource/CivicSource.Web/CivicSource.Administrator.Web/Content/scripts/property
git filter-branch --index-filter '
git ls-files -s |
sed "s,\t,&'"$PREFIX"'/," |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE
' HEAD
@chadly
chadly / graft.sh
Last active August 29, 2015 14:05
Split project out from another repo with a folder rename in the middle
#!/bin/bash
#http://stackoverflow.com/a/6638058/316108
git branch rename 65a6c070f80b3b3e071fed8360c1b589a2b64018
git branch pre-rename rename~
## First filter all commits up to rename, but not rename itself
git filter-branch --prune-empty --subdirectory-filter CivicSource/CivicSource.Util/CivicSource.Migrator pre-rename
## Add a graft, so our rename rev comes after the processed pre-rename revs
@chadly
chadly / keybase.md
Last active May 1, 2016 13:49
keybase.io proof

Keybase proof

I hereby claim:

  • I am chadly on github.
  • I am chadly (https://keybase.io/chadly) on keybase.
  • I have a public key ASBTKACyrzJ1v6PUsnKg5_bHIcPfYpvQKGi7pM000zuVmQo

To claim this, I am signing this object:

@chadly
chadly / delete-pre-release-tags.sh
Last active May 17, 2018 13:39
Delete prerelease git tags
#!/bin/bash
#this will delete tags that look like v7.1.0-adj-policy-update-ex.1+56
git tag -l | awk '/^(v.*-.*)$/ {print $1}' | xargs git tag -d
git ls-remote --tags origin | awk '/^(.*)(\s+)(.*v.+-)[^\^]+$/ {print ":" $2}' | xargs git push origin
# add back specific pre-release tags you want to keep
git tag v7.9.3-no-go-reason.1+5 a88ae0b7fdd9d76ccae35df6a96f43248a100ff6
# push those specific tags back to origin
@chadly
chadly / split-up-monorepo.sh
Last active March 11, 2019 21:55
Graft two repos together and then bake the graft in
# in first monorepo
git remote remove origin
git tag -l | xargs git tag -d
git filter-branch --prune-empty --subdirectory-filter FOLDER-NAME master
git update-ref -d refs/original/refs/heads/master
# in second repo (the one that was originally added to the monorepo)
git remote add cs ../civicsource
git fetch cs
@chadly
chadly / export-history.sh
Created August 28, 2019 22:30
Export commit history for specific date range for all repositories in a directory
for d in */ ; do
cd $d
git log --since 2015-03-01 --until 2016-06-30 --reverse --pretty=format:https://github.com/civicsource/${d}commit/%H,%an,%ad,\"%s\" --date=iso > ../${d::-1}.csv
cd ..
done
@chadly
chadly / processasync.cs
Created May 6, 2020 20:01
process items
List<Task> tasks = new List<Task>();
for (int i = 0; i < parallelTaskCount; i++)
{
tasks.Add(Task.Run(async () =>
{
try
{
await ProcessScopeAsync(provider.CreateScope());
}
@chadly
chadly / convert.ps
Last active July 14, 2020 23:43
Convert MKV file to 720p for iPad
ffmpeg -i in.mkv -vf "scale=-2:720" -vcodec libx264 -crf 30 -af "pan=stereo|FL < 1.0FL + 0.707FC + 0.707BL|FR < 1.0FR + 0.707FC + 0.707BR" out.mp4