type StringBool = "true"|"false";
interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };
type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| touch ~/.gitignore_global | |
| printf ".DS_Store\n.DS_Store?\n._*\n" >> ~/.gitignore_global | |
| git config --global core.excludesfile ~/.gitignore_global | |
| git config --global core.excludesfile | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -o pipefail | |
| TEMP_JSON=$(mktemp) | |
| govulncheck -format json ./... > "$TEMP_JSON" | |
| PARSED_DATA=$(jq -r '.osv.aliases[] | select(startswith("GHSA-"))' "$TEMP_JSON" 2>/dev/null | sort -u) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # add to top of file | |
| PS4='+ [${BASH_SOURCE}:${LINENO}] ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' | |
| set -x # Enable debug mode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git update-index --chmod=+x .github/scripts/coverage.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| The most atomic way to train and inference a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| port="9944" | |
| printf "\nSearches for processes running on port %s and performs a kill 9 on each pid" "$port" | |
| printf "\n------------------------- \n" | |
| printf "\nPrinting output from command: lsof -i :%s \n" "$port" | |
| lsof -i :$port |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| touch docs.log | |
| chmod 775 docs.log | |
| nohup yarn start --port 3000 > docs.log 2>&1 & echo $! > run.pid | |
| echo "Docusaurus running on process: $(cat run.pid)" | |
| echo "Docusaurus running on port 3000" | |
| echo "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Utility script: Wrap all unquoted parameter names (object keys) with double quotes | |
| // Usage: quote-json-keys.js | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const filePath = path.join(__dirname, 'config.json'); | |
| let text = fs.readFileSync(filePath, 'utf8'); |
NewerOlder