Curl-able Virtual Business Card

January 4th, 2022

Lately, with university and all, I've been feeling the need to up my game professionally. So, I've created a l33t new virtual business card!


The Command

To view my virtual business card, paste the following command into your terminal:


curl https://jakegines.in/card

Super cool, right? :D


(If you're not sure what to do with this command, click here to view an image of what you'd see)


How can I set this up for myself?

This is actually very simple to set up on your own website. By default, curl spits out the source code of the file it fetches into the terminal. All you need to do is create a .html file on your website and fill it with the content you would like to display.


For example, the HTML contents behind my business card are viewable at https://jakegines.in/card-html through any browser or the curl command. Viewing this through a browser will yield a wonky result though - no encoding is specified, and the content is not valid HTML. View the page source for the accurate source code.


I personally configured my primary business card to only be viewable through the curl command. I did this through only serving requests to user-agents that include the string "curl". I know this isn't fullproof since user-agents can be easily spoofed, but it'll cover 99% of the cases. My expressjs implementation is below:


1
2
3
4
5
app.get('/card', (req, res) => {
  if (req.headers['user-agent'].includes('curl')){
    res.sendFile(path.join(__dirname, 'public', 'card.html'));
  }
});

References

[1] "Curl Business Card" - Tom on The Internet, Youtube

[2] Curl Man Page, linux.die.net