If this codebase is production, handles money, or touches sensitive data: treat this audit loop as a high-risk operation. Run with least privilege, avoid exporting long-lived credentials in your shell, and keep the agent in read-only 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
| import requests | |
| from rich.console import Console | |
| from rich.table import Table | |
| urls = [ | |
| "https://reference-data-directory.vercel.app/feeds-mainnet.json", | |
| "https://reference-data-directory.vercel.app/feeds-bsc-mainnet.json", | |
| "https://reference-data-directory.vercel.app/feeds-matic-mainnet.json", | |
| "https://reference-data-directory.vercel.app/feeds-xdai-mainnet.json", | |
| "https://reference-data-directory.vercel.app/feeds-avalanche-mainnet.json", |
From Stack Overflow.
# Fetch the submodule commits into the main repository
git remote add submodule_origin git://url/to/submodule/origin
git fetch submodule_origin
# Start a fake merge (won't change any files, won't commit anything)
git merge -s ours --no-commit submodule_origin/master
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
| const calculate = (n, k) => { | |
| const exponent = (-k * (k - 1)) / (2 * n) | |
| return 1 - Math.E ** exponent | |
| } | |
| // where `n` is the number of possible unique hashes | |
| // where `k` is the number of values created | |
| // calculate(100000, 25) => 0.0029955044966269995 aka 0.29% chance of collision |
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
| func ComputeHmac256(message string, secret string) string { | |
| key := []byte(secret) | |
| h := hmac.New(sha256.New, key) | |
| h.Write([]byte(message)) | |
| return base64.StdEncoding.EncodeToString(h.Sum(nil)) | |
| } |
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
| // Grammar for parsing of the Fabric Endorsment Policies | |
| // | |
| // Defined in the documentation at | |
| // https://hyperledger-fabric.readthedocs.io/en/latest/endorsement-policies.html#endorsement-policy-syntax | |
| // The expression will be an operator with arguments, each of the arguments can be an expression | |
| // The OutOf operator is a bit different as that demands the first agument be a number | |
| Expression | |
| = op:Operator '(' _ args:Some_Expression_Args _ ')' | |
| { |
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
| #!/usr/bin/env sh | |
| HOST_PATH=$(pwd) | |
| GUEST_PATH=/usr/app | |
| HOST_EXPORT="${HOST_PATH} -network 192.168.99.0 -mask 255.255.255.0 -alldirs -maproot=root:wheel" | |
| if ! grep -q "$HOST_EXPORT" /etc/exports; then | |
| echo $HOST_EXPORT | sudo tee -a /etc/exports | |
| sudo nfsd restart | |
| fi |
NewerOlder