Skip to content

Instantly share code, notes, and snippets.

@johnrees
Last active February 18, 2022 05:49
Show Gist options
  • Save johnrees/d5378c6a40a8a3591dd632ba4a4c4a68 to your computer and use it in GitHub Desktop.
Save johnrees/d5378c6a40a8a3591dd632ba4a4c4a68 to your computer and use it in GitHub Desktop.
anchor viz
import axios from "axios";
import { createWriteStream } from "fs";
import { resolve } from "path";
async function downloadImage(url, filename) {
const path = resolve(__dirname, "../avatars", filename);
const response = await axios({
method: "GET",
url,
responseType: "stream",
});
response.data.pipe(createWriteStream(path));
return new Promise((resolve, reject) => {
response.data.on("end", resolve);
response.data.on("error", reject);
});
}
async function download() {
let finished = false;
let count = 0;
while (!finished) {
try {
const res = await axios.get(
`https://api.github.com/repos/project-serum/anchor/contributors?page=${++count}`
);
for (const item of res.data) {
await downloadImage(item.avatar_url, `${item.login}.png`);
}
} catch (err) {
console.error(err);
finished = true;
}
}
}
download();
brew install gource ffmpeg
git clone https://github.com/project-serum/anchor
cd anchor
mkdir avatars
npx esr getavatars.ts
gource -1280x720 --user-image-dir ./avatars --background-colour 000000 --font-colour 9945FF --highlight-colour 14F195 --time-scale 3.0 --seconds-per-day 0.5 --hide bloom,filenames,dirnames,mouse,progress --user-friction 5.0 --user-scale 5.0 -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 gource.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment