Ciro Santilli OurBigBook.com  Sponsor 中国独裁统治 China Dictatorship 新疆改造中心、六四事件、法轮功、郝海东、709大抓捕、2015巴拿马文件 邓家贵、低端人口、西藏骚乱
wikipedia/wikipedia-cattree.sh
#!/usr/bin/env bash
set -eu
cd out
rm -rf .git
git init
git remote add origin git@github.com:cirosantilli/wikipedia-cattree.git
cat >index.html <<'EOF'
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Wikipedia CatTree</title>
</head>
<body>
<h1>Wikipedia CatTree</h1>
<p>Methodology: <a href="https://stackoverflow.com/questions/17432254/wikipedia-category-hierarchy-from-dumps/77313490#77313490">https://stackoverflow.com/questions/17432254/wikipedia-category-hierarchy-from-dumps/77313490#77313490</a></p>
<ul>
EOF
for f in *.html; do
  if ( ! [ $f = 'index.html' ] ) && [ "$(du -b "$f" | awk '{ print $1 }')" -lt 100000000 ]; then
    git add "$f"
    printf '<li><a href="%s">%s</a></li>\n' "${f%.html}" "${f%.html}" >> index.html
  fi
done
cat >>index.html <<'EOF'
</ul>
</body>
</html>
EOF
git add index.html
touch .nojekyll
git add .nojekyll
export GIT_COMMITTER_NAME='Mr. Bot'
export GIT_AUTHOR_NAME="${GIT_COMMITTER_NAME}"
export GIT_COMMITTER_EMAIL='mrbot@mail.com'
export GIT_AUTHOR_EMAIL="${GIT_COMMITTER_EMAIL}"
GIT_COMMITTER_DATE='2000-01-01T00:00:00+0000' git commit --date '2000-01-01T00:00:00+0000' -m 'Autogenerated commit'
git push -f