Github Can Be Played Like This?

Categories: Creation

The personal answer to “What is the most interesting project you have seen on GitHub?” on Zhihu has some article feeling, so I put it directly into the column.

So how can it be played?

The answer is Make your Github profile page a blog homepage, and automatically update information display every day.

A few days ago, github released a new easter egg, which will automatically display the README of the repository with the same username under your repository to the top of your personal page, which looks like this:

github.com/tw93 Welcome to Follow, Welcome to Follow, Welcome to Follow 🏓🏓🏂🏂⛷⛷🤺🤼‍♀️🤾‍♀️🤽‍♀️⛸🏹🚣🏄🛀⛹🚴🏇

tPPfRZ

I spent two days of free time on the weekend tossing it. Through Github Actions, it automatically runs my open source warehouse, blog, WakaTime and Douban updates every day, and then writes them into README. Programmability has been greatly improved, very trendy!

How is it implemented? Sync knowledge points one by one to everyone

Prerequisite Knowledge

Clever way to automatically obtain information

The above implementation details can be seen in the github.com/tw93/tw93 repository, there are several good implementations:

1. Use the Api provided by Github

For example, Product Releases in the picture is implemented by using GraphqlClient in Python to obtain Github Graphql Api. First, get all the repository field information under the current user, and then assemble it into the format you need by string concatenation.

2. Using the RSS address of the website is very convenient

For example, for the Recent Blog and Funny Soul sections, blog information can be quickly obtained using feed.xml.

Douban’s dynamic information was originally intended to be crawled using python, but the implementation would be clumsy, and the login status needs to be maintained every once in a while. Coincidentally, I saw the following feed rss when processing personal page information, and I did what would have taken a day in half an hour;

Rss information processing can obtain the corresponding Rss content array through feedparser, and then concatenate it.

3. Use the API provided by automated tools

For example, the Weekly Development Breakdown section mentioned above, I highly recommend everyone to use the tool wakatime to count your code time. Specific usage can be Googled, not detailed here;

How to draw the figure below, you can refer to the code in tw93/waka-box, use wakatime-client to get information, and then also perform string concatenation processing. Since it was modified from a previous fork, a gist will be generated eventually.

Finally use httpx to get the corresponding raw text content, and then insert it through Markdown code syntax.

More Ideas

Combining Github Profile Readme and Actions capabilities can do more interesting things. For example, you can automatically generate articles that need to be read every day to the homepage, so you don’t need to look for them. Refer to github.com/simonw. Some processing borrowed simonw’s ideas when tossing on the weekend.

There is also a “funny way to play”, you can record an mp4, and then convert it to gif and put it on the homepage, which will be more interesting, such as praveenscience.

There is also a “more 6666”, directly moving the game to the homepage, moving chess pieces by sending issues, and then updating dynamically. Many people are playing, and there are rankings, very trendy, such as timburgan.

v2-1d3ac494f0a53a183e7da8f5566f9acd_hd

Found an awesome repository specifically for github profile readme, submitted a PR, which collects a lot of cases and usages, see abhisheknaiidu/awesome-github-profile-readme.

Ending

Suddenly feel that foreign programmers are quite good at playing, very trendy, worth our learning and communication, less meaningless overtime, write more interesting code.

Read More

Fliggy Serverless Technology Exploration and Implementation at GMTC

【2020-07-05】A sharing of the department's Serverless construction at the 2021 Beijing GMTC Global Frontend Developer Conference. I won the "Star Lecturer" on the spot and also met many friends. A very good experience.