Skip to content

Instantly share code, notes, and snippets.

@nabijaczleweli
Last active April 6, 2024 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nabijaczleweli/0c37fb1ee92a0a6cb23a to your computer and use it in GitHub Desktop.
Save nabijaczleweli/0c37fb1ee92a0a6cb23a to your computer and use it in GitHub Desktop.
Conversion script
#!/usr/bin/awk -f
BEGIN {
place = 1
}
/{/ {
sub(/[\[ ] { /, "")
sub(/ ]/, "")
gsub(/},/, "")
$0 = gensub(/'(.*)',/, "\\1", "g")
$0 = gensub(/'(.*)'/, "\\1", "g")
$0 = gensub(/([0-9]+),/, "\\1", "g")
print "<a href=\"http://chat.stackoverflow.com/users/" $2 "\">" $6 "</a> has " $4 " stars and is at place #" place "<br />"
++place
}
@nabijaczleweli
Copy link
Author

Pipe input in, for example with curl:

curl -s https://gist.githubusercontent.com/rlemon/d31b352f953b6b583960/raw/57beb33f85cf7a3a3c06532b813d1b8685b199bc/gistfile1.txt | awk -f maker.awk

output in "retarded html"

@nabijaczleweli
Copy link
Author

Now with place numbers!

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