Skip to content

Instantly share code, notes, and snippets.

View anthonydahanne's full-sized avatar

Anthony Dahanne anthonydahanne

View GitHub Profile
@anthonydahanne
anthonydahanne / force-push-to-main-branch.sh
Created April 24, 2023 21:19
Github has disabled force-push to the main branch; except that sometimes, that can come in handy. Use this gist with care ❤️
git checkout -b other-main
git push origin other-main
gh api -XPATCH "repos/pivotal-cf/tanzu-bellsoft-liberica" -f default_branch="other-main" >/dev/null
git push --delete tanzu main
gh api "repos/pivotal-cf/tanzu-bellsoft-liberica/branches/other-main/rename" -f new_name="main" >/dev/null
git checkout main
git pull origin main
# from https://stackoverflow.com/a/67638584/24069
# read each item in the JSON array to an item in the Bash array
set +x
readarray -t my_array < <(jq --raw-output '.[]' $1)
# iterate through the Bash array
for item in "${my_array[@]}"; do
git clone [email protected]:$item.git &>/dev/null
cd ${item#*/}
@anthonydahanne
anthonydahanne / UpdateReleaseNumbersPivnet
Last active July 7, 2023 14:02
Update release numbers on pivnet
A simple go app to connect to TanzuNet / Pivnet and update the release versions; to match the expected schema X.Y.Z instead of X.Y
@anthonydahanne
anthonydahanne / update-with-hacktoberfest-label.sh
Last active October 5, 2023 20:20
Script to ad the hacktoberfest label to existing issues matching a label
gh search issues --owner paketo-buildpacks --label "note:ideal-for-contribution" --limit 1000 --json repository,number | jq -r '.[] | [.number,.repository.nameWithOwner] | @tsv' | while IFS=$'\t' read -r number repository; do
echo "gh label -R $repository create hacktoberfest --description \"Hacktoberfest eligible\" --color D93F0B --force"
gh label -R $repository create hacktoberfest --description "Hacktoberfest eligible" --color D93F0B --force
echo "gh repo edit $repository --add-topic hacktoberfest"
gh repo edit $repository --add-topic hacktoberfest
echo "gh issue edit $number -R $repository --add-label \"hacktoberfest\""
gh issue edit $number -R $repository --add-label "hacktoberfest"
done
@anthonydahanne
anthonydahanne / update-tags.sh
Created December 22, 2023 00:24
Bash script to rename tags locally and remotely; with an exception
#!/bin/bash
for n in $(git tag)
do
if [ $n != "v6.0.4" ]; then
git tag ${n/v} $n
git tag -d $n
git push origin ${n/v} :$n
fi
done
@anthonydahanne
anthonydahanne / osx-pdf-from-markdown.markdown
Created August 9, 2024 01:34 — forked from georgiana-gligor/osx-pdf-from-markdown.markdown
Markdown source for the "Create PDF files from Markdown sources in OSX" article

Create PDF files from Markdown sources in OSX

When [Markdown][markdown] appeared more than 10 years ago, it aimed to make it easier to express ideas in an easy-to-write plain text format. It offers a simple syntax that takes the writer focus away from the formatting, thus giving her time to focus on the actual content.

The market abunds of editors to be used for help with markdown. After a few attempts, I settled to Sublime and its browser preview plugin, which work great for me and have a small memory footprint to accomplish that. To pass the results around to other people, less technical, a markdown file and a bunch of images is not the best approach, so converting it to a more robust format like PDF seems like a much better choice.

[Pandoc][pandoc] is the swiss-army knife of converting documents between various formats. While being able to deal with heavy-weight formats like docx and epub, we will need it for the more lightweight markdown. To be able to generate PDF files, we need LaTeX. On OSX, the s