# To reset the file status of a git submodule
git submodule foreach git reset --hard
# If you only want to reset a specific submodule
git submodule reset --hard <submodule-name>
# This will update the submodules to the latest revision in the repository,
# and it will also initialize any submodules that are not currently initialized.
git submodule update --init --recursive
This file contains 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
{ | |
"editor.inlayHints.enabled": "on", | |
"editor.inlayHints.fontFamily": "Courier New", | |
"editor.inlayHints.fontSize": 11, | |
"editor.semanticHighlighting.enabled": "configuredByTheme", | |
"editor.semanticTokenColorCustomizations": { | |
"enabled": true, | |
"rules": { |
This file contains 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
from __future__ import annotations | |
def max_sum(arr, k): | |
""" | |
It is used to find the maxumum or minimum sum, product, etc. | |
Time complexity: O(n) | |
""" | |
n = len(arr) | |
if n < k: |
This file contains 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 configuration of `cargo build --release` | |
[profile. Release] | |
debug = 1 # Whether debug information is included in the compiled code. 1 means that debug information is included, 0 means not. | |
# Whether incremental compilation is used. | |
# The incremental compilation can speed up compilation times by reusing previously compiled code, | |
# but it can also increase the size of the compiled code. | |
incremental = true |
This file contains 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
// { | |
// "go.toolsManagement.checkForUpdates": "local", | |
// "go.useLanguageServer": true, | |
// "go.gopath": "/go", | |
// "go.testEnvVars": { | |
// "C_INCLUDE_PATH":"${workspaceFolder}/go-llama:${workspaceFolder}/go-stable-diffusion/:${workspaceFolder}/gpt4all/gpt4all-bindings/golang/:${workspaceFolder}/go-ggml-transformers:${workspaceFolder}/go-rwkv:${workspaceFolder}/whisper.cpp:${workspaceFolder}/go-bert:${workspaceFolder}/bloomz", | |
// "LIBRARY_PATH":"${workspaceFolder}/go-llama:${workspaceFolder}/go-stable-diffusion/:${workspaceFolder}/gpt4all/gpt4all-bindings/golang/:${workspaceFolder}/go-ggml-transformers:${workspaceFolder}/go-rwkv:${workspaceFolder}/whisper.cpp:${workspaceFolder}/go-bert:${workspaceFolder}/bloomz", | |
// "TEST_DIR":"${workspaceFolder}/test-dir/", | |
// "FIXTURES":"${workspaceFolder}/tests/fixtures/", | |
// "CONFIG_FILE":"${workspaceFolder}/test-models/config.yaml", |
This file contains 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 clone --recurse-submodules $(GPT4ALL_REPO) gpt4all | |
# cd gpt4all && git checkout -b build $(GPT4ALL_VERSION) && git submodule update --init --recursive --depth 1 | |
# # This is hackish, but needed as both go-llama and go-gpt4allj have their own version of ggml.. | |
# @find ./gpt4all -type f -name "*.c " -exec sh -c "sed -e 's/ggml_/ggml_gptj_/g' {} > {}.tmp && mv {}.tmp {}" \; -print | wc -l | xargs echo "Number of files edited:" | |
# @find ./gpt4all -type f -name "*.cpp" -exec sh -c "sed -e 's/ggml_/ggml_gptj_/g' {} > {}.tmp && mv {}.tmp {}" \; -print | wc -l | xargs echo "Number of files edited:" | |
# @find ./gpt4all -type f -name "*.h" -exec sh -c "sed -e 's/ggml_/ggml_gptj_/g' {} > {}.tmp && mv {}.tmp {}" \; -print | wc -l | xargs echo "Number of files edited:" | |
# @find ./gpt4all -type f -name "*.cpp" -exec sh -c "sed -e 's/gpt_/gptj_/g' {} > {}.tmp && mv {}.tmp {}" \; -print | wc -l | xargs echo "Number of files edited:" | |
# @find ./gpt4all -type f -name "*.h" -exec sh -c "sed -e 's/gpt_/gptj_/g' {} > {}. |
This file contains 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
@count=$$(find ./go-bert -type f -name "*.c" -exec sh -c "sed 's/ggml_/ggml_bert_/g' {} > {}.tmp && mv {}.tmp {}" \; -print | wc -l); \ | |
echo "Edit *.c file:$$count" |
This file contains 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/local/bin python3 | |
# implementation for graph algorithms | |
class Graph: | |
def __init__(self, n): | |
# n is the number of nodes | |
self.n=n | |
# adj is the adjacency list | |
self.adj=[[] for _ in range(n)] |
This file contains 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/local/bin python3 | |
def activity_selection(start, finish): | |
""" | |
activity selection problem | |
start: start time of activities | |
finish: finish time of activities | |
return: selected activities | |
""" | |
n=len(start) |
Here's an example of the 0/1 knapsack problem:
Suppose you are a thief and you have broken into a jewelry store. You have a knapsack with a weight limit of 10 kg, and you have the option to steal the following items:
Item | Weight (kg) | Value ($) |
---|---|---|
A | 3 | 8 |
B | 1 | 10 |
C | 2 | 15 |
D | 5 | 25 |
NewerOlder