Repository: alii/website Branch: master Commit: 4c176843e38e Files: 68 Total size: 149.4 KB Directory structure: gitextract_snw5_0ev/ ├── .eslintrc.json ├── .github/ │ └── workflows/ │ └── lint.yml ├── .gitignore ├── .prettierignore ├── .vscode/ │ └── settings.json ├── LICENSE ├── README.md ├── SECURITY.md ├── next-env.d.ts ├── next.config.mjs ├── package.json ├── postcss.config.js ├── prettier.config.js ├── src/ │ ├── blog/ │ │ ├── 2022/ │ │ │ ├── 01/ │ │ │ │ ├── mochip/ │ │ │ │ │ └── mochip.tsx │ │ │ │ ├── serverless-discord-oauth/ │ │ │ │ │ └── serverless-discord-oauth.tsx │ │ │ │ └── zero-kb-blog/ │ │ │ │ └── zero-kb-blog.tsx │ │ │ ├── 03/ │ │ │ │ └── open-source/ │ │ │ │ └── open-source.tsx │ │ │ └── 08/ │ │ │ └── strict-tsconfig/ │ │ │ └── strict-tsconfig.tsx │ │ ├── 2023/ │ │ │ └── wtf-esm/ │ │ │ └── wtf-esm.tsx │ │ ├── 2025/ │ │ │ └── ambient-declarations/ │ │ │ └── ambient-declarations.tsx │ │ ├── Post.ts │ │ └── posts.ts │ ├── components/ │ │ ├── blog-footer.tsx │ │ ├── blog-post-list.tsx │ │ ├── external-link.tsx │ │ ├── message.tsx │ │ ├── note.tsx │ │ ├── stats.tsx │ │ └── syntax-highligher.tsx │ ├── global.d.ts │ ├── globals.css │ ├── hooks/ │ │ ├── layout.ts │ │ ├── use-did-initial-page-animations.ts │ │ ├── use-first-ever-load.ts │ │ ├── use-isomorphic-value.ts │ │ └── use-lerp-transform.ts │ ├── pages/ │ │ ├── 404.tsx │ │ ├── [slug].tsx │ │ ├── _app.tsx │ │ ├── _document.tsx │ │ ├── _error.tsx │ │ ├── api/ │ │ │ ├── contact.ts │ │ │ ├── map.ts │ │ │ ├── oauth/ │ │ │ │ └── [platform]/ │ │ │ │ ├── callback.ts │ │ │ │ └── redirect.ts │ │ │ ├── oauth.ts │ │ │ ├── og.tsx │ │ │ ├── ping.ts │ │ │ └── posts.ts │ │ ├── blog.tsx │ │ ├── demos/ │ │ │ └── serverless-discord-oauth.tsx │ │ ├── experiments/ │ │ │ ├── index.tsx │ │ │ ├── morphing-shapes.tsx │ │ │ └── rekordbox-history-parser.tsx │ │ ├── index.tsx │ │ ├── monzo/ │ │ │ └── dashboard/ │ │ │ └── index.tsx │ │ └── stats.tsx │ ├── server/ │ │ ├── api.ts │ │ ├── apple-maps.ts │ │ ├── env.ts │ │ ├── monzo.ts │ │ └── sessions.ts │ └── utils/ │ ├── constants.ts │ ├── discord.ts │ ├── lists.ts │ ├── timers.ts │ └── types.ts └── tsconfig.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .eslintrc.json ================================================ { "extends": ["next/core-web-vitals", "next/typescript"], "rules": { "react/no-unescaped-entities": "off", "@next/next/no-img-element": "off", "@typescript-eslint/no-namespace": "off" } } ================================================ FILE: .github/workflows/lint.yml ================================================ name: 'lint' on: push: branches: [master] pull_request: branches: [master] jobs: build: name: 'Lint' runs-on: ubuntu-latest steps: - name: Begin CI... uses: actions/checkout@v2 - uses: oven-sh/setup-bun@v1 with: bun-version: latest - name: Install dependencies run: bun install env: CI: true - name: Lint run: bun lint env: CI: true ================================================ FILE: .gitignore ================================================ /node_modules /.pnp .pnp.js /build .DS_Store .env .env.local .env.development.local .env.test.local .env.production.local *.log .vercel .idea .eslintcache .next out *.tsbuildinfo # Yarn .yarn/* !.yarn/releases !.yarn/plugins !.yarn/sdks !.yarn/versions # bun *.bun # Cloud9 IDE files .c9 ================================================ FILE: .prettierignore ================================================ .next dist build out node_modules .yarn .git ================================================ FILE: .vscode/settings.json ================================================ { "typescript.tsdk": "node_modules/typescript/lib", "typescript.enablePromptUseWorkspaceTsdk": true } ================================================ FILE: LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: README.md ================================================ 🦄 alii/website ================================================ FILE: SECURITY.md ================================================ # Security Policy Don't use this and expect it to be totally secure, but on that note, it's just a React app. ================================================ FILE: next-env.d.ts ================================================ /// /// import "./.next/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. ================================================ FILE: next.config.mjs ================================================ import { config as dotenv } from 'dotenv'; // @ts-check /** @type {import("next").NextConfig} */ const config = { env: dotenv().parsed, images: { remotePatterns: [ { protocol: 'https', hostname: 'i.scdn.co', pathname: '/image/*', }, { protocol: 'https', hostname: 'snapshot.apple-mapkit.com', pathname: '/api/v1/snapshot', }, ], }, async redirects() { return [ { source: '/outro', destination: 'https://www.youtube.com/watch?v=HeF11Av9WuU', permanent: true, }, { source: '/desu', destination: 'https://www.youtube.com/watch?v=HotGxCSas6A', permanent: true, }, { source: '/10', destination: 'https://youtu.be/G5HcvgepK-I', permanent: true, }, { source: '/lulzsec', destination: 'https://www.youtube.com/watch?v=DurOYPdXyF4', permanent: true, }, { source: '/wheels', destination: 'https://www.youtube.com/watch?v=9xRFN2i1cwQ', permanent: true, }, { source: '/letterone', destination: 'https://hyperfollow.com/alistair6/letter100-3', permanent: true, }, { source: '/live-25-01-2024', destination: 'https://www.youtube.com/watch?v=OvTy9xYH7LA', permanent: true, }, { source: '/live-02-02-2024', destination: 'https://youtube.com/watch?v=zEoTeUEElZc', permanent: true, }, { source: '/live-04-07-2024', destination: 'https://youtube.com/watch?v=-XsKN44b7ho', permanent: true, }, ]; }, }; export default config; ================================================ FILE: package.json ================================================ { "name": "website", "version": "1.0.0", "repository": "git@github.com:alii/website.git", "author": "Alistair Smith ", "license": "Apache-2.0", "private": true, "packageManager": "bun@1.0.0", "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "devDependencies": { "@tailwindcss/forms": "^0.5.11", "@tailwindcss/postcss": "^4.2.2", "@types/common-tags": "^1.8.4", "@types/cookie": "^1.0.0", "@types/jsonwebtoken": "^9.0.10", "@types/jwa": "^2.0.3", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", "@types/react-syntax-highlighter": "^15.5.13", "@types/uuid": "^10.0.0", "discord-api-types": "^0.38.42", "eslint": "9.27.0", "eslint-config-next": "15.1.8", "postcss": "^8.5.8", "prettier": "^3.8.1", "prettier-plugin-tailwindcss": "^0.6.14", "sharp": "^0.34.5", "tailwindcss": "^4.2.2", "typescript": "^6.0.2" }, "dependencies": { "@altano/satori-fit-text": "^1.0.2", "@c-side/next": "^1.0.0", "@marsidev/react-turnstile": "^1.5.0", "@next/third-parties": "^15.5.14", "@otters/monzo": "^2.1.2", "@prequist/lanyard": "^1.1.0", "@tailwindcss/typography": "^0.5.19", "@vercel/og": "^0.6.8", "alistair": "^1.17.0", "axios": "^1.14.0", "bwitch": "^0.3.0", "clsx": "^2.1.1", "common-tags": "^1.8.2", "cookie": "^1.1.1", "dayjs": "^1.11.20", "dotenv": "^16.6.1", "envsafe": "^2.0.3", "framer-motion": "^12.38.0", "jsonwebtoken": "^9.0.3", "jwa": "^2.0.1", "next": "^16.2.1", "nextkit": "^3.4.3", "react": "^19.2.4", "react-dom": "^19.2.4", "react-hot-toast": "^2.6.0", "react-icons": "^5.6.0", "react-syntax-highlighter": "^15.6.6", "satori": "^0.13.2", "use-lanyard": "^1.7.0", "uuid": "^11.1.0", "zod": "^3.25.76" } } ================================================ FILE: postcss.config.js ================================================ module.exports = { plugins: { '@tailwindcss/postcss': {}, }, }; ================================================ FILE: prettier.config.js ================================================ const alistair = require('alistair/prettier'); module.exports = { ...alistair, plugins: ['prettier-plugin-tailwindcss'], }; ================================================ FILE: src/blog/2022/01/mochip/mochip.tsx ================================================ import {stripIndent} from 'common-tags'; import {Highlighter} from '../../../../components/syntax-highligher'; import {Post} from '../../../Post'; import emailFromColin from './email-from-colin.png'; import gmeet from './gmeet.png'; import goodbyeMochip from './goodbye-mochip.png'; import hegartyTimeExploit from './hegarty-time-exploit.jpeg'; import mochipLanding from './landing.jpeg'; export class Mochip extends Post { public name = 'Avoiding homework with code (and getting caught)'; public slug = 'mochip'; public date = new Date('6 Jan 2022'); public excerpt = 'The eventful tale of me getting fed up with my homework'; public hidden = false; public keywords = [ 'school', 'homework', 'clout', 'hegarty maths', 'educake', 'homework hack', 'maths homework', 'programming', ]; public render() { return ( <>

Avoiding homework with code (and getting caught)

Back in 2020, my school used a few online learning platforms that allowed professors/teachers to assign homework to students. I, as a lazy developer, wanted to spend more time playing games and writing code, especially when everyone was spending their time at home because of lockdown. I started writing this post in January of 2022, but I put off publicizing it for a while. It has been long enough since this all happened, so please sit back and enjoy.

The back story

Let's set the scene. 2018, my school introduces a new online homework platform for students. It's called HegartyMaths and it does a lot. It's fairly simple, teachers choose a topic to set for us as homework, with that we get a 10-15 minute tutorial/informational video on the subject (of which we have to write down notes whilst watching) and a shortish quiz to complete after finishing the video. It's a lot of work, especially the quiz, and in the worst cases can take up to an hour to complete one topic (bad).

Mostly, software engineers are rather lazy individuals. We tell metal how to do stuff for us. Homework then, naturally, is an arduous task for a developer who is still at school. So, still 2018, a close friend of mine by the name of{' '} Scott Hiett {' '} and I decided to do something about the Hegarty situation. We started to reverse engineer the frontend app and eventually came up with a Tampermonkey userscript that would glitch the embedded YouTube player to say that we'd watched the video at least 1x. Crucially, our teachers could see how many times we'd watched the video, so being able to skip up to 20 minutes of homework time was especially useful – and it was a lot of fun to build too.

So we flexed it on our Snapchat stories and had our school friends message us to use it blah blah. We eventually figured out that we could also set it to be watched over 9999x times; every time we did that our accounts were reset by the Hegarty team.

The first email

After this, we got in contact with our Math teacher in November of 2018 and got her to send an email to HegartyMaths informing them of our petty exploit and they got back to us very quickly.{' '} I don't have the original email anymore but I distinctly remember it saying something along the lines of "Stop trying to hack our platform and get back to doing your homework." {' '} Edit: While writing this, I was able to uncover the deleted email from a photo we had taken of it in 2020. See below{' '} (certain details redacted for obvious reasons):

Hegarty Time Exploit Email

This response excited us a bit, as they were now aware of us messing around with the site and they had no intention of fixing the minor vuln we had anyway, so we kept using it. We had tried to build a script to answer the questions for us, but it was too much work at the time (complex data structures, weird API responses, etc etc).

Educake

For a while, students had access to another platform called Educake. Similar to HegartyMaths but targeting Biology, Chemistry and Physics. There was no video to watch at the beginning. We'd used it for a few years, in fact since I joined the school, but I'd never thought about reversing until all of this began.

One common factor between Hegarty and Educake is that they immediately give you the correct answer if you got a question wrong. We took advantage of this and wrote a small node/mongo app & tampermonkey script to detect when a user was on a quiz page, answer every question with a random number, and then store the correct answer in mongodb. I don't have the original source but the TamperMonkey script was probably something like the following:

{stripIndent` const guess = Math.random(); const result = await post('/api/answer', { body: { answer: guess, }, }); await post('http://localhost:8080/save', { body: { question_id: question.id, answer: result.success ? guess : result.correct_answer, }, }); // Go to next question and repeat code above nextQuestion(); `}

As you can see, it was quite literally a loop through every question, saving the correct answer as we got it and moving on. Eventually I added a few more features to fetch from the database if we already had the right answer (meaning we don't answer{' '} Math.random every time) and also I added in support for multiple choice (so that we actually pick one of the possible answers rather than making it up – however I was surprised that the Educake backend would allow an answer that wasn't even in the possible choices).

Now working on the project solo, I decided it would be time to build a nice UI for it all and bundle it all into a simple Tampermonkey script for both flexing rights on Snapchat (people constantly begging me to be able to use it was certainly ego fuel I hadn't experienced before) and also for myself to get out of homework I didn't want to do.

The end result? A ~200 line codebase that scooped up all questions and answers on the site that could repeatedly get 100% on every single assignment and a 15mb mongo database.

Below is a small video of what it all looked like. It also demonstrates a feature I added allowing for a "target percentage" — meaning users could get something other than 100% to look like more real/human score. Video was recorded on my Snapchat in November 2019.