Skip to content

Instantly share code, notes, and snippets.

View Aisuko's full-sized avatar
:octocat:
Etupirka

Aisuko Aisuko

:octocat:
Etupirka
View GitHub Profile
@Aisuko
Aisuko / settings.json
Created October 23, 2023 02:48
.vscode settings.json configuration
{
"editor.inlayHints.enabled": "on",
"editor.inlayHints.fontFamily": "Courier New",
"editor.inlayHints.fontSize": 11,
"editor.semanticHighlighting.enabled": "configuredByTheme",
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"rules": {
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:
@Aisuko
Aisuko / Cargo.toml
Created June 17, 2023 03:16
Cargo file for cargo build --release command
# 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
@Aisuko
Aisuko / settings.json
Created May 31, 2023 09:59
settings.json file for Codespace debug golang code.
// {
// "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",
# 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' {} > {}.
@Aisuko
Aisuko / git_submodule.md
Created May 17, 2023 08:36
git commands for sub module
# 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
@Aisuko
Aisuko / shell_replace_files.sh
Created May 16, 2023 14:26
Shell command for replacing files
@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"
@Aisuko
Aisuko / graph.py
Last active April 16, 2023 06:15
bfs and dfs for graph
#! 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)]
@Aisuko
Aisuko / activity_selection.py
Last active April 16, 2023 06:18
Implementation for greedy algorithms
#! 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)
@Aisuko
Aisuko / knapsack_description.md
Created April 16, 2023 04:11
The description for knapsack problem

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