Skip to content

Instantly share code, notes, and snippets.

@martinwoodward
Last active August 22, 2022 14:12
Show Gist options
  • Save martinwoodward/288812fa142e0b1153f60b9555b3d978 to your computer and use it in GitHub Desktop.
Save martinwoodward/288812fa142e0b1153f60b9555b3d978 to your computer and use it in GitHub Desktop.
Very quick ruby script to create a bash script that will create a montage of your org.
# Set OCTOKIT_ACCESS_TOKEN to authenticate with a PAT
# Something like OCTOKIT_ACCESS_TOKEN=<<TOKEN>> bundle exec ruby create-org-montage-script.rb
require "octokit"
Octokit.auto_paginate = true
# Replace <<ORG_NAME>> with your GitHub org
members = Octokit.org_members "<<ORG_NAME>>"
open('org-montage.sh', 'w') { |f|
# Yeah, I'm creating a bash script in Ruby - bite me
f << "#!/bin/bash\n"
members.each do |m|
f << "curl " + m[:avatar_url] + " --output images/" + m[:id].to_s + ".jpg\n"
end
# Uses 'montage' command from ImageMagick (apt install imagemagick)
# http://www.imagemagick.org/Usage/montage/
# You probably want to play with the number across here to get a 16:9 image.
# I'm creating an image that is 58 images wide made up of 48x48 pixel tiles.
f << "montage images/*.jpg -resize 48x48 -mode Concatenate -tile 58x ghmontage.jpg\n"
}
@andyfeller
Copy link

For posterity, this work has been incorporated into https://github.com/andyfeller/gh-montage as an easy to use GitHub CLI extension!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment