Here are the steps you should follow to get started working on your own computer in COMP1531.
- Install VS Code
| { | |
| // Disable AI slop | |
| // =============== | |
| // The (supposed) single off switch, which doesn't actually work | |
| "chat.disableAIFeatures": true, | |
| // Turn off the chat panel, and all of the background services for AI slop | |
| // that I don't want to use | |
| "chat.agent.enabled": false, |
| import ctypes | |
| class ArrowInt(int): | |
| def __neg__(self) -> int: | |
| prev = int(self) | |
| self_addr = id(self) | |
| int_addr = self_addr + ctypes.sizeof(ctypes.c_size_t) + 2 * ctypes.sizeof(ctypes.c_void_p) | |
| ctypes.c_int.from_address(int_addr).value = self - 1 | |
| # Return previous value so it loops a sensible number of times | |
| return prev |
| """ | |
| A quick demo of how scope capturing works in Python. | |
| This code works because inner functions capture a reference | |
| to the original function's scope when they get defined, | |
| rather than a shallow copy of it. | |
| It's so janky and weird, and yet it makes perfect sense. | |
| It's almost poetic. I love Python so much. | |
| """ |
| // Place your key bindings in this file to override the defaults | |
| [ | |
| // New file commands | |
| // ============================================= | |
| // New file command in explorer by default | |
| { | |
| "key": "ctrl+n", | |
| "command": "explorer.newFile" | |
| }, | |
| // New directory in explorer: Ctrl+Shift+N |
| appnope==0.1.4 ; python_version >= "3.9" and python_version < "4.0" and platform_system == "Darwin" \ | |
| --hash=sha256:1de3860566df9caf38f01f86f65e0e13e379af54f9e4bee1e66b48f2efffd1ee \ | |
| --hash=sha256:502575ee11cd7a28c0205f379b525beefebab9d161b7c964670864014ed7213c | |
| asttokens==2.4.1 ; python_version >= "3.9" and python_version < "4.0" \ | |
| --hash=sha256:051ed49c3dcae8913ea7cd08e46a606dba30b79993209636c4875bc1d637bc24 \ | |
| --hash=sha256:b03869718ba9a6eb027e134bfdf69f38a236d681c83c160d510768af11254ba0 | |
| blinker==1.8.1 ; python_version >= "3.9" and python_version < "4.0" \ | |
| --hash=sha256:5f1cdeff423b77c31b89de0565cd03e5275a03028f44b2b15f912632a58cced6 \ | |
| --hash=sha256:da44ec748222dcd0105ef975eed946da197d5bdf8bafb6aa92f5bc89da63fa25 | |
| certifi==2024.2.2 ; python_version >= "3.9" and python_version < "4.0" \ |
| { | |
| "todo-tree.highlights.defaultHighlight": { | |
| "foreground": "white", | |
| "background": "#00000000" | |
| }, | |
| "todo-tree.highlights.useColourScheme": false, | |
| "todo-tree.general.tags": [ | |
| "BUG", | |
| "FIXME", | |
| "BROKEN", |
| const { execSync } = require('node:child_process'); | |
| const MAX_LENGTH = 100; | |
| // https://stackoverflow.com/a/44574128/6335363 | |
| const ALLOWED_CHARACTERS = [...Array(26).keys()].map((n) => String.fromCharCode(97 + n)); | |
| ALLOWED_CHARACTERS.push('-'); | |
| function installPackage(name) { | |
| execSync(`npm install ${name}`, { stdio: 'inherit' }); |
| """ | |
| A simple script to install everything | |
| """ | |
| from subprocess import Popen | |
| from string import ascii_lowercase | |
| MAX_LENGTH = 100 | |
| ALLOWED_CHARACTERS = ascii_lowercase + '-' |
Here are the steps you should follow to get started working on your own computer in COMP1531.
| # Simple function to grab a .gitignore file from GitHub | |
| # Usage: gitignore [language name] | |
| # Note that it's case-sensitive. This it GitHub's fault, not mine | |
| gitignore () | |
| { | |
| curl -s --fail "https://raw.githubusercontent.com/github/gitignore/main/$1.gitignore" -o .gitignore | |
| if [ $? -eq 0 ]; then | |
| return 0 | |
| else | |
| echo "Lookup failed, maybe check capitalisation?" |