Skip to content

Instantly share code, notes, and snippets.

Created July 13, 2020 04:03
Show Gist options
  • Save ryanlanciaux/3e29e75bd32efee9681c2ab85b99cc6f to your computer and use it in GitHub Desktop.
Save ryanlanciaux/3e29e75bd32efee9681c2ab85b99cc6f to your computer and use it in GitHub Desktop.
// This app initially started from Flavio Copes analytics example
// but diverged quite a bit to generate images as well as track views
const express = require('express')
const app = express()
// no db - so global var to keep track of count
let counter = 0
function getCountImage(count) {
// This is not the greatest way for generating an SVG but it'll do for now
const countArray = count.toString().padStart(6, '0').split('');
const parts = countArray.reduce((acc, next, index) => `
<rect id="Rectangle" fill="#000000" x="${index * 32}" y="0.5" width="29" height="29"></rect>
<text id="0" font-family="Courier" font-size="24" font-weight="normal" fill="#00FF13">
<tspan x="${index * 32 + 7}" y="22">${next}</tspan>
`, '');
return `<?xml version="1.0" encoding="UTF-8"?>
<svg width="189px" height="30px" viewBox="0 0 189 30" version="1.1" xmlns="" xmlns:xlink="">
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
// get the image
app.get('/count.svg', (req, res) => {
// This helps with GitHub's image cache
// see more:
'content-type': 'image/svg+xml',
'cache-control': 'max-age=0, no-cache, no-store, must-revalidate'
// Send the generated SVG as the result
const listener = app.listen(process.env.PORT, () => {
console.log('Your app is listening on port ' + listener.address().port)
Copy link

refs commented Jul 16, 2020

for I in {1..800}
curl '' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0' -H 'Accept: image/webp,*/*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer:' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache'

essentially substitute f428d5a0306d32cebc1396e58667b6cbc34d7e16/68747470733a2f2f7279616e2d6c616e63696175782d636f756e7465722e676c697463682e6d652f636f756e742e737667 with yours and funs ensured :D, someone else can also boost your visits since there is no authentication :)

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