From 6c9192d62b1636dbf3d7c71ca598cd6d0f4e530b Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 7 Nov 2023 19:19:55 +0200 Subject: [PATCH 01/23] new aider args notes --- linux/linux_network.sh | 8 ++++++++ linux/setup aider.md | 1 + 2 files changed, 9 insertions(+) diff --git a/linux/linux_network.sh b/linux/linux_network.sh index 7c5d555..efc4e76 100644 --- a/linux/linux_network.sh +++ b/linux/linux_network.sh @@ -3,3 +3,11 @@ sudo systemctl stop systemd-resolved sudo systemctl disable systemd-resolved sudo systemctl enable systemd-resolved sudo systemctl start systemd-resolved + + + +# show all interfaces except docker +ifconfig | awk '/^(br-|veth)/ {flag=1; next} /^$/ {flag=0} !flag' + + + diff --git a/linux/setup aider.md b/linux/setup aider.md index b3f8a12..ffc70ba 100644 --- a/linux/setup aider.md +++ b/linux/setup aider.md @@ -15,6 +15,7 @@ export PATH=$PATH:/home/linuxbrew/.linuxbrew/bin/ctags # personal export OPENAI_API_KEY=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 +aider -3 --no-auto-commits # dev-bro GPT4 export OPENAI_API_KEY=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 \ No newline at end of file From 27645f5e6b1a1b09d4b4435a61137db0c49cbaa9 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Sat, 16 Dec 2023 21:36:53 +0000 Subject: [PATCH 02/23] population plot 10% --- python/population_plot.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 python/population_plot.py diff --git a/python/population_plot.py b/python/population_plot.py new file mode 100644 index 0000000..1fe3bee --- /dev/null +++ b/python/population_plot.py @@ -0,0 +1,22 @@ +import matplotlib.pyplot as plt +import numpy as np + +# Initial population +population = 1_000_000 +death_rate = 0.10 +years = np.arange(0, 1001, 100) # 0 to 1000 years in 100-year intervals + +# Calculate population after each 100-year interval +population_values = [population] +for year in years[1:]: + population -= death_rate * population + population_values.append(population) + +# Create the graph +plt.figure(figsize=(8, 6)) +plt.plot(years, population_values, marker='o', linestyle='-', color='b') +plt.xlabel('Years') +plt.ylabel('Population') +plt.title('Population Projection') +plt.grid(True) +plt.show() From 88becd9fe0e7cb72e6ec128302ce30b12b06aa89 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Sat, 16 Dec 2023 21:43:00 +0000 Subject: [PATCH 03/23] 4000 to 1k --- python/population_plot.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/python/population_plot.py b/python/population_plot.py index 1fe3bee..17a8719 100644 --- a/python/population_plot.py +++ b/python/population_plot.py @@ -4,19 +4,26 @@ import numpy as np # Initial population population = 1_000_000 death_rate = 0.10 -years = np.arange(0, 1001, 100) # 0 to 1000 years in 100-year intervals +years = np.arange(4000, 10001, 500) # 4000 to 10000 years in 500-year intervals -# Calculate population after each 100-year interval -population_values = [population] -for year in years[1:]: - population -= death_rate * population +# Calculate population after each 500-year interval +population_values = [] +for year in years: + # Apply the death rate for each 500-year period (5 times for each interval) + for _ in range(5): + population -= death_rate * population population_values.append(population) -# Create the graph +# Create the graph with labels for each data point plt.figure(figsize=(8, 6)) plt.plot(years, population_values, marker='o', linestyle='-', color='b') plt.xlabel('Years') plt.ylabel('Population') -plt.title('Population Projection') +plt.title('Population Projection from Year 4000') + +# Adding labels to the data points +for i, txt in enumerate(population_values): + plt.annotate(f"{int(txt):,}", (years[i], population_values[i]), textcoords="offset points", xytext=(0,10), ha='center') + plt.grid(True) plt.show() From d684d0a6b52004e2584ca7e04cc4d0343ebd38e1 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Sat, 16 Dec 2023 21:45:17 +0000 Subject: [PATCH 04/23] add plot range --- python/population_plot.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/python/population_plot.py b/python/population_plot.py index 17a8719..482514d 100644 --- a/python/population_plot.py +++ b/python/population_plot.py @@ -1,25 +1,35 @@ import matplotlib.pyplot as plt import numpy as np -# Initial population -population = 1_000_000 +# Initial population at year 1 +initial_population = 1_000_000 death_rate = 0.10 -years = np.arange(4000, 10001, 500) # 4000 to 10000 years in 500-year intervals -# Calculate population after each 500-year interval +# Start and stop years for the graph +start_year = 4000 +stop_year = 10000 +interval = 500 # Interval for plotting data points + +# Calculate the population at the start of the start_year +current_population = initial_population +for _ in range(start_year // 100): # Dividing by 100 as the death rate is applied every 100 years + current_population -= death_rate * current_population + +# Now calculate and plot the population from start_year to stop_year +years = np.arange(start_year, stop_year + 1, interval) population_values = [] for year in years: - # Apply the death rate for each 500-year period (5 times for each interval) - for _ in range(5): - population -= death_rate * population - population_values.append(population) + # Apply the death rate for each interval (interval/100 times for each period) + for _ in range(interval // 100): + current_population -= death_rate * current_population + population_values.append(current_population) # Create the graph with labels for each data point plt.figure(figsize=(8, 6)) plt.plot(years, population_values, marker='o', linestyle='-', color='b') plt.xlabel('Years') plt.ylabel('Population') -plt.title('Population Projection from Year 4000') +plt.title(f'Population Projection from Year {start_year} to {stop_year}') # Adding labels to the data points for i, txt in enumerate(population_values): From 201512ef3a60b4450dcb51d73ab99d62c162907a Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Sat, 16 Dec 2023 22:35:28 +0000 Subject: [PATCH 05/23] fix range and --- python/population_plot.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/python/population_plot.py b/python/population_plot.py index 482514d..c101633 100644 --- a/python/population_plot.py +++ b/python/population_plot.py @@ -1,7 +1,7 @@ import matplotlib.pyplot as plt import numpy as np -# Initial population at year 1 +# Initial population at year 0 initial_population = 1_000_000 death_rate = 0.10 @@ -10,30 +10,30 @@ start_year = 4000 stop_year = 10000 interval = 500 # Interval for plotting data points -# Calculate the population at the start of the start_year +# Initialize population calculations current_population = initial_population -for _ in range(start_year // 100): # Dividing by 100 as the death rate is applied every 100 years - current_population -= death_rate * current_population +population_values = [initial_population] # Include initial population as the first data point +years = np.arange(0, stop_year + 1, 100) # Calculate every 100 years -# Now calculate and plot the population from start_year to stop_year -years = np.arange(start_year, stop_year + 1, interval) -population_values = [] -for year in years: - # Apply the death rate for each interval (interval/100 times for each period) - for _ in range(interval // 100): - current_population -= death_rate * current_population +# Apply the death rate for each 100-year period +for year in years[1:]: + current_population -= death_rate * current_population population_values.append(current_population) +# Filter the years and population values for the graph +graph_years = np.arange(start_year, stop_year + 1, interval) +graph_population_values = [population for year, population in zip(years, population_values) if year >= start_year and year in graph_years] + # Create the graph with labels for each data point plt.figure(figsize=(8, 6)) -plt.plot(years, population_values, marker='o', linestyle='-', color='b') +plt.plot(graph_years, graph_population_values, marker='o', linestyle='-', color='b') plt.xlabel('Years') plt.ylabel('Population') plt.title(f'Population Projection from Year {start_year} to {stop_year}') # Adding labels to the data points -for i, txt in enumerate(population_values): - plt.annotate(f"{int(txt):,}", (years[i], population_values[i]), textcoords="offset points", xytext=(0,10), ha='center') +for i, txt in enumerate(graph_population_values): + plt.annotate(f"{int(txt):,}", (graph_years[i], graph_population_values[i]), textcoords="offset points", xytext=(0,10), ha='center') plt.grid(True) plt.show() From ba5e73f0271a4b81f247d5f931083d750dc01a42 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 17 Jan 2024 18:19:35 +0200 Subject: [PATCH 06/23] added home router configure --- NOTES/useful commands.md | 1 + _CONFIGS/home router config.md | 30 ++++++++++++++++++++++++++++++ linux/disk fscheck.md | 10 ++++++++++ 3 files changed, 41 insertions(+) create mode 100644 NOTES/useful commands.md create mode 100644 _CONFIGS/home router config.md create mode 100644 linux/disk fscheck.md diff --git a/NOTES/useful commands.md b/NOTES/useful commands.md new file mode 100644 index 0000000..17c3908 --- /dev/null +++ b/NOTES/useful commands.md @@ -0,0 +1 @@ +docker init \ No newline at end of file diff --git a/_CONFIGS/home router config.md b/_CONFIGS/home router config.md new file mode 100644 index 0000000..ab9b763 --- /dev/null +++ b/_CONFIGS/home router config.md @@ -0,0 +1,30 @@ +192.168.0.1 + popov %TGBnhy6= WPA2 AES + popov5G %TGBnhy6= auto auto + popov-guest wpa-psk aes 12345678 + -TP-Archer C6 Zelenakravapasetrev@ (original PIN:35390466, MAC: D8-07-B6-17-03-AE) + https://94.156.137.3:8444 + http://94.156.137.3:1024 +WAN: 192.168.100.3 DNS 20.101.62.76/1.1.1.3 +DHCP: 92.168.0.100-249 DNS 192.168.0.10/20.101.62.76 +RESERVATIONS: +C4-65-16-9A-E4-CD +192.168.0.11 +E8-65-D4-33-06-D0 +192.168.0.4 +10-FE-ED-B7-3E-D1 +192.168.0.3 +34-64-A9-D1-84-75 +192.168.0.10 +68-5D-43-A8-07-46 +192.168.0.20 +2C-56-DC-F0-14-80 +192.168.0.9 +B4-2E-99-3A-99-CB +192.168.0.2 +60-6D-C7-5E-63-29 +192.168.0.15 +30-85-A9-23-1D-F6 +192.168.0.13 +A4-CF-12-F5-22-8D +192.168.0.18 \ No newline at end of file diff --git a/linux/disk fscheck.md b/linux/disk fscheck.md new file mode 100644 index 0000000..9737928 --- /dev/null +++ b/linux/disk fscheck.md @@ -0,0 +1,10 @@ +sudo umount /mnt/mmc + +sudo fsck.vfat -a /dev/sdX1 +sudo fsck.ext4 -cDfty -C 0 /dev/sdX1 +-a: Automatically repair errors. +-c: Check for bad blocks. +-D: Optimize directories when possible. +-f: Force a check, even if the filesystem appears clean. +-t: Print timing stats (optional). +-C 0: Display progress information. \ No newline at end of file From 19538749c57c882e83a64addaa996b283af7d326 Mon Sep 17 00:00:00 2001 From: popov Date: Mon, 22 Jan 2024 08:41:35 +0000 Subject: [PATCH 07/23] added portainer reset passwd info --- linux/docker install.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux/docker install.md b/linux/docker install.md index 98765c1..c3eb7dd 100644 --- a/linux/docker install.md +++ b/linux/docker install.md @@ -9,6 +9,11 @@ sudo apt-get install docker-ce # add portainer docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always --pull=always -v /var/run/docker.sock:/var/run/docker.sock -v /mnt/storage/docker_volumes/portainer_data:/data portainer/portainer-ce +# change portainer admin password +docker stop portainer +docker pull portainer/helper-reset-password +docker run --rm -v /mnt/storage/docker_volumes/portainer_data:/data portainer/helper-reset-password + # start sudo systemctl start docker From 96335ad501cdf1a34bb300bde494280da3362cfa Mon Sep 17 00:00:00 2001 From: popov Date: Mon, 22 Jan 2024 09:10:23 +0000 Subject: [PATCH 08/23] added docker cmd --- linux/docker install.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux/docker install.md b/linux/docker install.md index c3eb7dd..0a8d7c6 100644 --- a/linux/docker install.md +++ b/linux/docker install.md @@ -22,3 +22,7 @@ sudo systemctl enable docker # build image sudo docker build -t your-image-name . + +# attach to container +docker exec -it potainer /bin/sh + From cffa6a40bb36d04d7360194cd39965257888c404 Mon Sep 17 00:00:00 2001 From: popov Date: Fri, 2 Feb 2024 14:32:26 +0000 Subject: [PATCH 09/23] added ai notes --- ai-ollama.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 ai-ollama.md diff --git a/ai-ollama.md b/ai-ollama.md new file mode 100644 index 0000000..223fb75 --- /dev/null +++ b/ai-ollama.md @@ -0,0 +1,2 @@ +run llama code 7b in ollama" +ollama run codellama:7b-code \ No newline at end of file From a52364878c5c49a4783b4c1182dae4442c5d2f08 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 21 Feb 2024 18:21:57 +0200 Subject: [PATCH 10/23] notes --- linux/docker install.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux/docker install.md b/linux/docker install.md index 98765c1..3cc8cee 100644 --- a/linux/docker install.md +++ b/linux/docker install.md @@ -1,5 +1,7 @@ # install sudo apt-get update +sudo apt update +sudo apt install gnupg sudo apt-get install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" From 4402fef237d3732a1c02c800e8d3721c86d5f29f Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 6 Mar 2024 11:26:01 +0200 Subject: [PATCH 11/23] misc scripts --- dev/docker deploy.md | 11 +++++++++ dev/node react.md | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 dev/docker deploy.md create mode 100644 dev/node react.md diff --git a/dev/docker deploy.md b/dev/docker deploy.md new file mode 100644 index 0000000..ed37045 --- /dev/null +++ b/dev/docker deploy.md @@ -0,0 +1,11 @@ +# Step 1: Build the Docker Image +docker build -t my-next-app . +# Step 2: Save the Docker Image +docker save my-next-app > my-next-app.tar +# Step 3: Transfer the Image to the Production Server +scp my-next-app.tar user@your-server-ip:/path/to/directory +# Step 4: Load the Image on the Production Server +ssh user@your-server-ip +docker load < my-next-app.tar +# Step 5: Run the Docker Container +docker run -d -p 80:3000 my-next-app \ No newline at end of file diff --git a/dev/node react.md b/dev/node react.md new file mode 100644 index 0000000..0c7c994 --- /dev/null +++ b/dev/node react.md @@ -0,0 +1,54 @@ +copy + +# npm remove excessive package dependencies +# 1.Use Dependency Analysis Tools +npm install -g depcheck +depcheck +# or +npm install -g npm-check +npm-check + +# 2.Bundle Size Analysis: +npm install --save-dev webpack-bundle-analyzer +# edit webpack to push BundleAnalyzerPlugin to config.plugins +# run #> ANALYZE=true npm run build + +npm uninstall yargs-parser + +yargs-parser +Unused dependencies +* @date-io/date-fns +* @mui/icons-material +* @react-pdf/renderer +* docx +* docx-templates +* docxtemplater +* excel4node +* fs +* gapi +* gapi-script +* html-to-docx +* module-alias +* node-excel-export +* nodemailer-smtp-transport +* prisma-binding +* react-cookies +* react-file-reader +* react-hook-form +* react-router-dom +* react-table +* sqlite3 +* xml-js +Unused devDependencies +* @types/react-table +* autoprefixer +* postcss +* typescript +Missing dependencies +* @fullcalendar/core: ./styles/calendar.scss +* @fullcalendar/daygrid: ./styles/calendar.scss +* @fullcalendar/timegrid: ./styles/calendar.scss +* google-auth-library: ./src/helpers/calendar.js +* open: ./src/helpers/calendar.js +* pages: ./pages/dash.tsx +* src: ./pages/cart/publishers/import.tsx \ No newline at end of file From dc2af0386d0d306d0c9bda593ffac9d4444d24d3 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Mon, 8 Apr 2024 12:36:16 +0300 Subject: [PATCH 12/23] local changes DEV --- NOTES/useful commands.md | 1 + _CONFIGS/home router config.md | 30 +++++++++++ _ideas/project ideas.md | 3 ++ ai-ollama.md | 2 + dev/docker deploy.md | 11 ++++ dev/node react.md | 54 +++++++++++++++++++ git/git combine multiple commits.md | 80 +++++++++++++++++++++++++++++ linux/disk fscheck.md | 10 ++++ linux/setup aider.md | 2 +- python/population_plot.py | 39 ++++++++++++++ 10 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 NOTES/useful commands.md create mode 100644 _CONFIGS/home router config.md create mode 100644 _ideas/project ideas.md create mode 100644 ai-ollama.md create mode 100644 dev/docker deploy.md create mode 100644 dev/node react.md create mode 100644 git/git combine multiple commits.md create mode 100644 linux/disk fscheck.md create mode 100644 python/population_plot.py diff --git a/NOTES/useful commands.md b/NOTES/useful commands.md new file mode 100644 index 0000000..17c3908 --- /dev/null +++ b/NOTES/useful commands.md @@ -0,0 +1 @@ +docker init \ No newline at end of file diff --git a/_CONFIGS/home router config.md b/_CONFIGS/home router config.md new file mode 100644 index 0000000..ab9b763 --- /dev/null +++ b/_CONFIGS/home router config.md @@ -0,0 +1,30 @@ +192.168.0.1 + popov %TGBnhy6= WPA2 AES + popov5G %TGBnhy6= auto auto + popov-guest wpa-psk aes 12345678 + -TP-Archer C6 Zelenakravapasetrev@ (original PIN:35390466, MAC: D8-07-B6-17-03-AE) + https://94.156.137.3:8444 + http://94.156.137.3:1024 +WAN: 192.168.100.3 DNS 20.101.62.76/1.1.1.3 +DHCP: 92.168.0.100-249 DNS 192.168.0.10/20.101.62.76 +RESERVATIONS: +C4-65-16-9A-E4-CD +192.168.0.11 +E8-65-D4-33-06-D0 +192.168.0.4 +10-FE-ED-B7-3E-D1 +192.168.0.3 +34-64-A9-D1-84-75 +192.168.0.10 +68-5D-43-A8-07-46 +192.168.0.20 +2C-56-DC-F0-14-80 +192.168.0.9 +B4-2E-99-3A-99-CB +192.168.0.2 +60-6D-C7-5E-63-29 +192.168.0.15 +30-85-A9-23-1D-F6 +192.168.0.13 +A4-CF-12-F5-22-8D +192.168.0.18 \ No newline at end of file diff --git a/_ideas/project ideas.md b/_ideas/project ideas.md new file mode 100644 index 0000000..686b6e1 --- /dev/null +++ b/_ideas/project ideas.md @@ -0,0 +1,3 @@ +AI: + +petals private farm aider - self improving assistant jw documents vector database embedding \ No newline at end of file diff --git a/ai-ollama.md b/ai-ollama.md new file mode 100644 index 0000000..223fb75 --- /dev/null +++ b/ai-ollama.md @@ -0,0 +1,2 @@ +run llama code 7b in ollama" +ollama run codellama:7b-code \ No newline at end of file diff --git a/dev/docker deploy.md b/dev/docker deploy.md new file mode 100644 index 0000000..ed37045 --- /dev/null +++ b/dev/docker deploy.md @@ -0,0 +1,11 @@ +# Step 1: Build the Docker Image +docker build -t my-next-app . +# Step 2: Save the Docker Image +docker save my-next-app > my-next-app.tar +# Step 3: Transfer the Image to the Production Server +scp my-next-app.tar user@your-server-ip:/path/to/directory +# Step 4: Load the Image on the Production Server +ssh user@your-server-ip +docker load < my-next-app.tar +# Step 5: Run the Docker Container +docker run -d -p 80:3000 my-next-app \ No newline at end of file diff --git a/dev/node react.md b/dev/node react.md new file mode 100644 index 0000000..0c7c994 --- /dev/null +++ b/dev/node react.md @@ -0,0 +1,54 @@ +copy + +# npm remove excessive package dependencies +# 1.Use Dependency Analysis Tools +npm install -g depcheck +depcheck +# or +npm install -g npm-check +npm-check + +# 2.Bundle Size Analysis: +npm install --save-dev webpack-bundle-analyzer +# edit webpack to push BundleAnalyzerPlugin to config.plugins +# run #> ANALYZE=true npm run build + +npm uninstall yargs-parser + +yargs-parser +Unused dependencies +* @date-io/date-fns +* @mui/icons-material +* @react-pdf/renderer +* docx +* docx-templates +* docxtemplater +* excel4node +* fs +* gapi +* gapi-script +* html-to-docx +* module-alias +* node-excel-export +* nodemailer-smtp-transport +* prisma-binding +* react-cookies +* react-file-reader +* react-hook-form +* react-router-dom +* react-table +* sqlite3 +* xml-js +Unused devDependencies +* @types/react-table +* autoprefixer +* postcss +* typescript +Missing dependencies +* @fullcalendar/core: ./styles/calendar.scss +* @fullcalendar/daygrid: ./styles/calendar.scss +* @fullcalendar/timegrid: ./styles/calendar.scss +* google-auth-library: ./src/helpers/calendar.js +* open: ./src/helpers/calendar.js +* pages: ./pages/dash.tsx +* src: ./pages/cart/publishers/import.tsx \ No newline at end of file diff --git a/git/git combine multiple commits.md b/git/git combine multiple commits.md new file mode 100644 index 0000000..66cbffc --- /dev/null +++ b/git/git combine multiple commits.md @@ -0,0 +1,80 @@ + +git checkout -b review-branch + + +oldest_commit_hash=$(git log --grep="GAT-4861" --reverse --format="%H" | head -1) +git checkout -b review-branch $oldest_commit_hash^ + + +$oldestCommitHash = git log --grep="GAT-4861" --reverse --format="%H" | Select-Object -First 1 +git checkout -b review-branch $oldestCommitHash^ + + + +git log --grep="GAT-4861" --format="%H" | xargs -L1 git cherry-pick + +git log --grep="GAT-4861" --format="%H" | ForEach-Object { git cherry-pick $_ } + +git log --grep="GAT-4861" --format="%H" | ForEach-Object { + git cherry-pick $_ --strategy-option theirs +} +git log --reverse --grep="GAT-4861" --format="%H" | ForEach-Object { + git cherry-pick $_ --strategy-option theirs +} + +git log master --reverse --grep="GAT-4861" --format="%H" | ForEach-Object { + git cherry-pick $_ --strategy-option theirs --no-commit + if ($LASTEXITCODE -ne 0) { + Write-Host "Conflict encountered. Skipping commit $_" + git reset --merge + } +} + + +git checkout master # Replace 'main' with your default branch name if different +git branch -D review-branch + + + + +git checkout master # Replace 'main' with your default branch name if different +git branch -D review-branch + +$oldestCommitHash = git log --grep="GAT-4861" --reverse --format="%H" | Select-Object -First 1 +git checkout -b review-branch $oldestCommitHash^ + +git log master --reverse --grep="GAT-4861" --format="%H" | ForEach-Object { + git cherry-pick $_ --strategy-option theirs --no-commit + if ($LASTEXITCODE -ne 0) { + Write-Host "Conflict encountered. Skipping commit $_" + git reset --merge + } +} + + + + +git diff $(git log --grep="GAT-4861" --format="%H" | tail -n 1)^ $(git log --grep="GAT-4861" --format="%H" | head -n 1) > changes.patch + + +$firstCommit = git log --grep="GAT-4861" --reverse --format="%H" | Select-Object -First 1 +$lastCommit = git log --grep="GAT-4861" --format="%H" | Select-Object -First 1 +git diff $firstCommit^ $lastCommit > changes.patch + + + + +# Checkout to the parent of the earliest "GAT-4861" commit +$earliestCommitHash = git log --grep="GAT-4861" --reverse --format="%H" | Select-Object -First 1 +git checkout -b review-branch $earliestCommitHash^ + +# Apply the patch +git apply changes.patch + + + diff --git a/linux/disk fscheck.md b/linux/disk fscheck.md new file mode 100644 index 0000000..9737928 --- /dev/null +++ b/linux/disk fscheck.md @@ -0,0 +1,10 @@ +sudo umount /mnt/mmc + +sudo fsck.vfat -a /dev/sdX1 +sudo fsck.ext4 -cDfty -C 0 /dev/sdX1 +-a: Automatically repair errors. +-c: Check for bad blocks. +-D: Optimize directories when possible. +-f: Force a check, even if the filesystem appears clean. +-t: Print timing stats (optional). +-C 0: Display progress information. \ No newline at end of file diff --git a/linux/setup aider.md b/linux/setup aider.md index 44aae3b..203f39f 100644 --- a/linux/setup aider.md +++ b/linux/setup aider.md @@ -21,5 +21,5 @@ export PATH=$PATH:/home/linuxbrew/.linuxbrew/bin/ctags export OPENAI_API_KEY=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 aider -3 --no-auto-commits -# dev-bro GPT4 +# !!!!! dev-bro GPT4 export OPENAI_API_KEY=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 \ No newline at end of file diff --git a/python/population_plot.py b/python/population_plot.py new file mode 100644 index 0000000..c101633 --- /dev/null +++ b/python/population_plot.py @@ -0,0 +1,39 @@ +import matplotlib.pyplot as plt +import numpy as np + +# Initial population at year 0 +initial_population = 1_000_000 +death_rate = 0.10 + +# Start and stop years for the graph +start_year = 4000 +stop_year = 10000 +interval = 500 # Interval for plotting data points + +# Initialize population calculations +current_population = initial_population +population_values = [initial_population] # Include initial population as the first data point +years = np.arange(0, stop_year + 1, 100) # Calculate every 100 years + +# Apply the death rate for each 100-year period +for year in years[1:]: + current_population -= death_rate * current_population + population_values.append(current_population) + +# Filter the years and population values for the graph +graph_years = np.arange(start_year, stop_year + 1, interval) +graph_population_values = [population for year, population in zip(years, population_values) if year >= start_year and year in graph_years] + +# Create the graph with labels for each data point +plt.figure(figsize=(8, 6)) +plt.plot(graph_years, graph_population_values, marker='o', linestyle='-', color='b') +plt.xlabel('Years') +plt.ylabel('Population') +plt.title(f'Population Projection from Year {start_year} to {stop_year}') + +# Adding labels to the data points +for i, txt in enumerate(graph_population_values): + plt.annotate(f"{int(txt):,}", (graph_years[i], graph_population_values[i]), textcoords="offset points", xytext=(0,10), ha='center') + +plt.grid(True) +plt.show() From 70938c3b15fc9a736d9c17bf5ea0842e450a0b61 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 9 Apr 2024 18:45:48 +0300 Subject: [PATCH 13/23] dvbern forticlient setup + vscode --- linux/setup forticlient.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/linux/setup forticlient.sh b/linux/setup forticlient.sh index 6e2b526..80fe0bb 100644 --- a/linux/setup forticlient.sh +++ b/linux/setup forticlient.sh @@ -1,6 +1,17 @@ #wget https://links.fortinet.com/forticlient/deb/vpnagent #wget https://filestore.fortinet.com/forticlient/forticlient_vpn_7.0.7.0246_amd64.deb apt update -sudo su -apt install openfortivpn -openfortivpn vpn.gateway.one:10443 -u 'Dobromir Popov' --trusted-cert bd26362cc802a27102fcdbf7e7e9328f3dede58aa44c125ede4aadb9e39da8c8 +apt install -y openfortivpn ppp +openfortivpn vpn.gateway.one:10443 -u 'dobromir.popov@gateway.one' --trusted-cert bd26362cc802a27102fcdbf7e7e9328f3dede58aa44c125ede4aadb9e39da8c8 + + +#ERROR: pppd: The kernel does not support PPP, for example, the PPP kernel driver is not included or cannot be loaded. +docker run --cap-add=NET_ADMIN your_image + privileged: true + cap_add: + - NET_ADMIN + +# useradd popov +# passwd popov +# usermod -aG sudo popov +code --no-sandbox --user-data-dir /home/popov/.config/Code \ No newline at end of file From ab2cbb73e41b1f62d0f1be0c88faebe3ed7b5b93 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 10 Apr 2024 00:05:44 +0300 Subject: [PATCH 14/23] instructions to isntall mono on linux for ASP.net 4.8 apps --- linux/install mono for .net4.8 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 linux/install mono for .net4.8 diff --git a/linux/install mono for .net4.8 b/linux/install mono for .net4.8 new file mode 100644 index 0000000..238029a --- /dev/null +++ b/linux/install mono for .net4.8 @@ -0,0 +1,20 @@ +https://www.mono-project.com/download/stable/#download-lin-ubuntu + +sudo apt install ca-certificates gnupg +sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list +sudo apt update + + +sudo apt install mono-devel + + + + + +dotnet restore /workspace/repos/bitbucket.org/gatewayserver/GatewayServer.sln + +sudo apt-get update +sudo apt-get install nuget +nuget restore /workspace/repos/bitbucket.org/gatewayserver/GatewayServer.sln + From 9fbfc0890eec17c2e9e862f2340f34fd17743869 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 24 Apr 2024 11:57:31 +0300 Subject: [PATCH 15/23] more aider notes --- linux/setup aider.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/linux/setup aider.md b/linux/setup aider.md index 203f39f..61fdb23 100644 --- a/linux/setup aider.md +++ b/linux/setup aider.md @@ -2,6 +2,7 @@ in conda env: pip install aider-chat # latest python -m pip install git+https://github.com/paul-gauthier/aider.git +python -m pip install git+https://github.com/d-popov/aider.git # isntall ctags # > sudo apt update && apt install universal-ctags @@ -15,6 +16,15 @@ brew install universal-ctags /home/linuxbrew/.linuxbrew/bin/ctags export PATH=$PATH:/home/linuxbrew/.linuxbrew/bin/ctags +# KEYS + +export GROQ_API_KEY=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 +export OPENAI_API_BASE=http://ollama.d-popov.com +export AIDER_4=false +export AIDER_35TURBO=false + + + # RUN > aider # personal @@ -22,4 +32,25 @@ export OPENAI_API_KEY=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 aider -3 --no-auto-commits # !!!!! dev-bro GPT4 -export OPENAI_API_KEY=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 \ No newline at end of file +export OPENAI_API_KEY=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 + + + +usage: aider [-h] [--openai-api-key OPENAI_API_KEY] [--anthropic-api-key ANTHROPIC_API_KEY] [--model MODEL] [--models MODEL] [--opus] [--sonnet] [--4] [--4-turbo-vision] [--35turbo] + [--voice-language VOICE_LANGUAGE] [--openai-api-base OPENAI_API_BASE] [--openai-api-type OPENAI_API_TYPE] [--openai-api-version OPENAI_API_VERSION] + [--openai-api-deployment-id OPENAI_API_DEPLOYMENT_ID] [--openai-organization-id OPENAI_ORGANIZATION_ID] [--edit-format EDIT_FORMAT] [--weak-model WEAK_MODEL] + [--show-model-warnings | --no-show-model-warnings] [--map-tokens MAP_TOKENS] [--input-history-file INPUT_HISTORY_FILE] [--chat-history-file CHAT_HISTORY_FILE] [--dark-mode] + [--light-mode] [--pretty | --no-pretty] [--stream | --no-stream] [--user-input-color USER_INPUT_COLOR] [--tool-output-color TOOL_OUTPUT_COLOR] + [--tool-error-color TOOL_ERROR_COLOR] [--assistant-output-color ASSISTANT_OUTPUT_COLOR] [--code-theme CODE_THEME] [--show-diffs] [--git | --no-git] + [--gitignore | --no-gitignore] [--aiderignore AIDERIGNORE] [--auto-commits | --no-auto-commits] [--dirty-commits | --no-dirty-commits] [--dry-run | --no-dry-run] [--commit] + [--version] [--check-update] [--skip-check-update] [--apply FILE] [--yes] [-v] [--show-repo-map] [--message COMMAND] [--message-file MESSAGE_FILE] [--encoding ENCODING] + [-c CONFIG_FILE] + [FILE ...] + +### OLLAMA || GROQ +export GROQ_API_KEY=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 +aider --models groq/ +# #################################################### # +aider --model groq/llama3-70b-8192 --no-auto-commits +# OLLAMA? +aider --openai-api-base https://ollama.d-popov.com --models openai/ \ No newline at end of file From 5019e388bf8a76d7dc4bb7ac3ab0a3f7e5dc8d84 Mon Sep 17 00:00:00 2001 From: popov Date: Tue, 18 Jun 2024 17:23:34 +0300 Subject: [PATCH 16/23] add git commit search --- git/git combine multiple commits.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git/git combine multiple commits.md b/git/git combine multiple commits.md index 66cbffc..f2e1ea5 100644 --- a/git/git combine multiple commits.md +++ b/git/git combine multiple commits.md @@ -77,4 +77,5 @@ git checkout -b review-branch $earliestCommitHash^ git apply changes.patch - +# search for 'App_Code' in commit msgs +git log --all --grep="App_Code" From 1ea2f19d1197d2f5aa600da93c8286cd8066df7f Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 16 Jul 2024 12:05:04 +0300 Subject: [PATCH 17/23] generate marmaid graph --- git/generae_overview_mermaid.sh | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 git/generae_overview_mermaid.sh diff --git a/git/generae_overview_mermaid.sh b/git/generae_overview_mermaid.sh new file mode 100644 index 0000000..103f7c3 --- /dev/null +++ b/git/generae_overview_mermaid.sh @@ -0,0 +1,37 @@ +$ #!/bin/bash + +# Function to escape special characters for Mermaid +escape_for_mermaid() { + echo "$1" | sed 's/[^a-zA-Z0-9]/_/g' +} + +# Start the Mermaid diagram +echo "%%{init: { 'theme': 'base' } }%%" +echo "gitGraph" + +# Set master as the main branch +main_branch="master" + +# Start with the main branch +echo " commit id: \"Initial commit\"" + +# Keep track of declared branches +declared_branches=("$main_branch") + +# Function to find the base branch +find_base_branch() { + local branch=$1 + local base=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$branch" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//') + if [[ -z "$base" ]]; then + echo "$main_branch" + else + echo "$base" + fi +} + +# Function to declare a branch if not already declared +declare_branch() { + local branch=$1 + if [[ ! " ${declared_branches[@]} " =~ " ${branch} " ]]; then + echo " branch $branch" +doneprocess_branch "$branch"--sort=committerdate --format='%(refname:short)' refs/heads/) \ No newline at end of file From 37cdca37195403d72cab7cd03a8913673f52937f Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 16 Jul 2024 12:18:35 +0300 Subject: [PATCH 18/23] mermaid save to file, fix --- git/generae_overview_mermaid.sh | 37 ++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/git/generae_overview_mermaid.sh b/git/generae_overview_mermaid.sh index 103f7c3..a2cbe25 100644 --- a/git/generae_overview_mermaid.sh +++ b/git/generae_overview_mermaid.sh @@ -1,11 +1,15 @@ -$ #!/bin/bash +#!/bin/bash # Function to escape special characters for Mermaid escape_for_mermaid() { echo "$1" | sed 's/[^a-zA-Z0-9]/_/g' } +# Output file +output_file="branches_diagram.mmd" + # Start the Mermaid diagram +{ echo "%%{init: { 'theme': 'base' } }%%" echo "gitGraph" @@ -14,9 +18,12 @@ main_branch="master" # Start with the main branch echo " commit id: \"Initial commit\"" +echo " branch $main_branch" +echo " checkout $main_branch" # Keep track of declared branches -declared_branches=("$main_branch") +declare -A declared_branches +declared_branches[$main_branch]=1 # Function to find the base branch find_base_branch() { @@ -32,6 +39,26 @@ find_base_branch() { # Function to declare a branch if not already declared declare_branch() { local branch=$1 - if [[ ! " ${declared_branches[@]} " =~ " ${branch} " ]]; then - echo " branch $branch" -doneprocess_branch "$branch"--sort=committerdate --format='%(refname:short)' refs/heads/) \ No newline at end of file + if [[ -z "${declared_branches[$branch]}" ]]; then + echo " branch $(escape_for_mermaid "$branch")" + declared_branches[$branch]=1 + fi +} + +# Process each branch +for branch in $(git for-each-ref --sort=committerdate --format='%(refname:short)' refs/heads/); do + base_branch=$(find_base_branch "$branch") + + declare_branch "$branch" + + echo " checkout $(escape_for_mermaid "$branch")" + echo " commit id: \"$(git log -1 --pretty=format:%s "$branch")\"" + + if [ "$branch" != "$main_branch" ]; then + echo " checkout $(escape_for_mermaid "$base_branch")" + echo " merge $(escape_for_mermaid "$branch")" + fi +done +} > $output_file + +echo "Mermaid diagram saved to $output_file" From 7568039e165de3478eff5a8c7b5778345c71dcc3 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 16 Jul 2024 13:10:33 +0300 Subject: [PATCH 19/23] new v --- git/generae_overview_mermaid.sh | 44 ++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/git/generae_overview_mermaid.sh b/git/generae_overview_mermaid.sh index a2cbe25..9d5c0c9 100644 --- a/git/generae_overview_mermaid.sh +++ b/git/generae_overview_mermaid.sh @@ -22,13 +22,23 @@ echo " branch $main_branch" echo " checkout $main_branch" # Keep track of declared branches -declare -A declared_branches -declared_branches[$main_branch]=1 +declared_branches=("$main_branch") + +# Function to check if a branch is declared +is_branch_declared() { + local branch=$1 + for declared_branch in "${declared_branches[@]}"; do + if [[ "$declared_branch" == "$branch" ]]; then + return 0 + fi + done + return 1 +} # Function to find the base branch find_base_branch() { local branch=$1 - local base=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$branch" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//') + local base=$(git merge-base --fork-point "$branch" "$main_branch" || echo "$main_branch") if [[ -z "$base" ]]; then echo "$main_branch" else @@ -39,9 +49,9 @@ find_base_branch() { # Function to declare a branch if not already declared declare_branch() { local branch=$1 - if [[ -z "${declared_branches[$branch]}" ]]; then + if ! is_branch_declared "$branch"; then echo " branch $(escape_for_mermaid "$branch")" - declared_branches[$branch]=1 + declared_branches+=("$branch") fi } @@ -50,15 +60,31 @@ for branch in $(git for-each-ref --sort=committerdate --format='%(refname:short) base_branch=$(find_base_branch "$branch") declare_branch "$branch" - echo " checkout $(escape_for_mermaid "$branch")" echo " commit id: \"$(git log -1 --pretty=format:%s "$branch")\"" - if [ "$branch" != "$main_branch" ]; then - echo " checkout $(escape_for_mermaid "$base_branch")" - echo " merge $(escape_for_mermaid "$branch")" + # Check which branches are merged into this branch + merged_branches=$(git branch --merged "$branch" | grep -v "\* $branch" | grep -v "$main_branch") + if [ -n "$merged_branches" ]; then + for merged_branch in $merged_branches; do + if [ "$merged_branch" != "$branch" ]; then + declare_branch "$merged_branch" + echo " checkout $(escape_for_mermaid "$branch")" + echo " merge $(escape_for_mermaid "$merged_branch")" + fi + done fi done + +# Check for branches not yet merged into master +not_merged=$(git branch --no-merged "$main_branch") +if [ -n "$not_merged" ]; then + echo " commit id: \"Branches not yet merged into master:\"" + for branch in $not_merged; do + echo " commit id: \"$branch\"" + done +fi + } > $output_file echo "Mermaid diagram saved to $output_file" From d7672c195901452d265ffae2493717393494a31d Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 16 Jul 2024 14:24:47 +0300 Subject: [PATCH 20/23] fixes. added appbeyor script and diagram (wip) --- git/generae_overview_mermaid.sh | 32 +++++++------ python/appveyor.mmd | 35 ++++++++++++++ python/deployments_graph.py | 85 +++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 15 deletions(-) create mode 100644 python/appveyor.mmd create mode 100644 python/deployments_graph.py diff --git a/git/generae_overview_mermaid.sh b/git/generae_overview_mermaid.sh index 9d5c0c9..7b88d18 100644 --- a/git/generae_overview_mermaid.sh +++ b/git/generae_overview_mermaid.sh @@ -55,25 +55,27 @@ declare_branch() { fi } +# Function to recursively process merged branches +process_merged_branches() { + local branch=$1 + local merged_branches=$(git branch --merged "$branch" | grep -v "\* $branch" | grep -v "$main_branch") + if [ -n "$merged_branches" ]; then + for merged_branch in $merged_branches; do + declare_branch "$merged_branch" + echo " checkout $(escape_for_mermaid "$branch")" + echo " merge $(escape_for_mermaid "$merged_branch")" + process_merged_branches "$merged_branch" + done + fi +} + # Process each branch for branch in $(git for-each-ref --sort=committerdate --format='%(refname:short)' refs/heads/); do base_branch=$(find_base_branch "$branch") - declare_branch "$branch" echo " checkout $(escape_for_mermaid "$branch")" echo " commit id: \"$(git log -1 --pretty=format:%s "$branch")\"" - - # Check which branches are merged into this branch - merged_branches=$(git branch --merged "$branch" | grep -v "\* $branch" | grep -v "$main_branch") - if [ -n "$merged_branches" ]; then - for merged_branch in $merged_branches; do - if [ "$merged_branch" != "$branch" ]; then - declare_branch "$merged_branch" - echo " checkout $(escape_for_mermaid "$branch")" - echo " merge $(escape_for_mermaid "$merged_branch")" - fi - done - fi + process_merged_branches "$branch" done # Check for branches not yet merged into master @@ -81,10 +83,10 @@ not_merged=$(git branch --no-merged "$main_branch") if [ -n "$not_merged" ]; then echo " commit id: \"Branches not yet merged into master:\"" for branch in $not_merged; do - echo " commit id: \"$branch\"" + echo " commit id: \"$branch\" - merged into: $(git branch --merged "$branch" | grep -v "\* $branch" | grep -v "$main_branch" | tr '\n' ' ')" done fi } > $output_file -echo "Mermaid diagram saved to $output_file" +echo "Mermaid diagram saved to $output_file" \ No newline at end of file diff --git a/python/appveyor.mmd b/python/appveyor.mmd new file mode 100644 index 0000000..84ab1a8 --- /dev/null +++ b/python/appveyor.mmd @@ -0,0 +1,35 @@ +graph TD + A[Common Configuration] --> B[master] + A[Common Configuration] --> C[stable] + A[Common Configuration] --> D[deployment] + A[Common Configuration] --> E[GAT-5073] + A[Common Configuration] --> F[GAT-5098] + + B --> B1[Release_ProfessionalTestServer] + B --> B2[Release_TestServer] + B --> B3[Release_DemoServer] + B1 --> G[TESTPRO on master] + B2 --> H[TEST on master] + B3 --> I[DEMO on master] + + C --> C1[Release_DemoServer] + C --> C2[Release_ProfessionalTestServer] + C1 --> J[DEMO on stable] + C2 --> K[TESTPRO on stable] + + D --> D1[Release_ProductionServer] + D --> D2[Release_ProfessionalServer] + D1 --> L[PROD Staging on deployment] + D2 --> M[PRO on deployment] + + E --> E1[Staging_TestServer] + E1 --> N[TEST-Staging on GAT-5073] + + F --> F1[Staging_DemoServer] + F1 --> O[DEMO-Staging on GAT-5098] + + style A fill:#f9f,stroke:#333,stroke-width:2px + + style C1 fill:#bbf,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5 + style C2 fill:#bbf,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5 + diff --git a/python/deployments_graph.py b/python/deployments_graph.py new file mode 100644 index 0000000..7d118c8 --- /dev/null +++ b/python/deployments_graph.py @@ -0,0 +1,85 @@ +import yaml + +# Load the YAML content from the file +with open('appveyor.yml', 'r') as file: + appveyor_yml = file.read() + +# Parsing the YAML content +config = yaml.safe_load(appveyor_yml) + +# Extract branches and configurations from the YAML +branches = {} +deployments = {} +inactive_branches = [] + +# Extract specific branch configurations +if 'for' in config: + for branch_config in config['for']: + branch_names = branch_config.get('branches', {}).get('only', []) + configurations = branch_config.get('configuration', []) + for branch in branch_names: + if branch not in branches: + branches[branch] = [] + branches[branch].extend(configurations) + +# Manually add common branches and configurations if not already included +if 'branches' in config: + common_branches = config['branches'].get('only', []) + for branch in common_branches: + if branch not in branches: + branches[branch] = config.get('configuration', []) + +# Check for inactive branches in the comments +lines = appveyor_yml.splitlines() +for i, line in enumerate(lines): + if line.strip().startswith('#') and i + 2 < len(lines) and 'branches:' in lines[i + 1] and 'only:' in lines[i + 2]: + inactive_branches.append(lines[i + 2].split(':')[1].strip()) + +# Extract deployment configurations +if 'deploy' in config: + deployments['common'] = config['deploy'] + +if 'for' in config: + for branch_config in config['for']: + branch_names = branch_config.get('branches', {}).get('only', []) + if 'deploy' in branch_config: + for branch in branch_names: + if branch not in deployments: + deployments[branch] = [] + deployments[branch].extend(branch_config['deploy']) + +# Generate the Mermaid graph content +mermaid_graph = """ +graph TD + A[Common Configuration] --> B[master] +""" + +# Add branches to the graph +for branch in branches.keys(): + if branch != 'master': + mermaid_graph += f" A --> {branch.replace('-', '_')}\n" + +# Add configurations to the branches +for branch, configs in branches.items(): + for config in configs: + mermaid_graph += f" {branch.replace('-', '_')} --> {branch.replace('-', '_')}{config}\n" + +# Add deployments to the configurations +for branch, deploys in deployments.items(): + for deploy in deploys: + configuration = deploy.get('configuration') + website = deploy.get('website') + if configuration and website: + mermaid_graph += f" {branch.replace('-', '_')}{configuration.replace('_', '')} --> {branch.replace('-', '_')}{website.replace('-', '_')}\n" + +# Highlight inactive branches +for inactive_branch in inactive_branches: + mermaid_graph += f" style {inactive_branch.replace('-', '_')} fill:#f96,stroke:#333,stroke-width:2px,stroke-dasharray: 5, 5\n" + +# Add styles to the graph +mermaid_graph += """ + style A fill:#f9f,stroke:#333,stroke-width:2px + style B fill:#bbf,stroke:#333,stroke-width:2px +""" + +print(mermaid_graph) From bb9fa824cc8000769a900d69ea73e80739e4d0b6 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 16 Jul 2024 14:27:05 +0300 Subject: [PATCH 21/23] script improved --- python/deployments_graph.py | 48 ++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/python/deployments_graph.py b/python/deployments_graph.py index 7d118c8..f6d9e0e 100644 --- a/python/deployments_graph.py +++ b/python/deployments_graph.py @@ -1,4 +1,5 @@ import yaml +import re # Load the YAML content from the file with open('appveyor.yml', 'r') as file: @@ -11,6 +12,7 @@ config = yaml.safe_load(appveyor_yml) branches = {} deployments = {} inactive_branches = [] +inactive_configs = {} # Extract specific branch configurations if 'for' in config: @@ -29,11 +31,13 @@ if 'branches' in config: if branch not in branches: branches[branch] = config.get('configuration', []) -# Check for inactive branches in the comments +# Check for inactive branches and configurations in the comments lines = appveyor_yml.splitlines() for i, line in enumerate(lines): + if re.match(r'#\s*-\s*(\w+)', line): + inactive_configs.setdefault(lines[i-1].strip().split()[1], []).append(re.findall(r'#\s*-\s*(\w+)', line)[0].replace('-', '_')) if line.strip().startswith('#') and i + 2 < len(lines) and 'branches:' in lines[i + 1] and 'only:' in lines[i + 2]: - inactive_branches.append(lines[i + 2].split(':')[1].strip()) + inactive_branches.append(lines[i + 2].split(':')[1].strip().replace('-', '_')) # Extract deployment configurations if 'deploy' in config: @@ -51,35 +55,41 @@ if 'for' in config: # Generate the Mermaid graph content mermaid_graph = """ graph TD - A[Common Configuration] --> B[master] + A[Common Configuration] """ # Add branches to the graph for branch in branches.keys(): - if branch != 'master': - mermaid_graph += f" A --> {branch.replace('-', '_')}\n" + branch_id = branch.replace('-', '_') + mermaid_graph += f" A --> {branch_id}\n" # Add configurations to the branches for branch, configs in branches.items(): + branch_id = branch.replace('-', '_') + for idx, config in enumerate(configs): + config_id = f"{branch_id}{idx+1}" + mermaid_graph += f" {branch_id} --> {config_id}[{config}]\n" + # Add deployments to the configurations + for deploy in deployments.get(branch, []): + configuration = deploy.get('configuration') + if configuration == config: + service = deploy.get('service', '') + mermaid_graph += f" {config_id} --> {service_id}[{deploy.get('on', {}).get('configuration', '')} on {branch}]\n" + +# Highlight inactive branches and configurations with a dotted style +for branch in inactive_branches: + mermaid_graph += f" style {branch} fill:#f96,stroke:#333,stroke-width:2px,stroke-dasharray: 5, 5\n" + +for branch, configs in inactive_configs.items(): + branch_id = branch.replace('-', '_') for config in configs: - mermaid_graph += f" {branch.replace('-', '_')} --> {branch.replace('-', '_')}{config}\n" - -# Add deployments to the configurations -for branch, deploys in deployments.items(): - for deploy in deploys: - configuration = deploy.get('configuration') - website = deploy.get('website') - if configuration and website: - mermaid_graph += f" {branch.replace('-', '_')}{configuration.replace('_', '')} --> {branch.replace('-', '_')}{website.replace('-', '_')}\n" - -# Highlight inactive branches -for inactive_branch in inactive_branches: - mermaid_graph += f" style {inactive_branch.replace('-', '_')} fill:#f96,stroke:#333,stroke-width:2px,stroke-dasharray: 5, 5\n" + config_id = f"{branch_id}_{config}" + mermaid_graph += f" style {config_id} fill:#bbf,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5\n" # Add styles to the graph mermaid_graph += """ style A fill:#f9f,stroke:#333,stroke-width:2px - style B fill:#bbf,stroke:#333,stroke-width:2px """ +# Output the graph print(mermaid_graph) From e570f0a1b2ca0eed255e18f11685c152fe7b5bea Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 16 Jul 2024 14:27:16 +0300 Subject: [PATCH 22/23] new commands added to wiki --- git/git combine multiple commits.md | 2 ++ linux/setup aider.md | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/git/git combine multiple commits.md b/git/git combine multiple commits.md index 66cbffc..4b4767c 100644 --- a/git/git combine multiple commits.md +++ b/git/git combine multiple commits.md @@ -78,3 +78,5 @@ git apply changes.patch +# push to new remote branch (if not existing) + git push -u origin main \ No newline at end of file diff --git a/linux/setup aider.md b/linux/setup aider.md index 61fdb23..947088e 100644 --- a/linux/setup aider.md +++ b/linux/setup aider.md @@ -48,9 +48,9 @@ usage: aider [-h] [--openai-api-key OPENAI_API_KEY] [--anthropic-api-key ANTHROP [FILE ...] ### OLLAMA || GROQ -export GROQ_API_KEY=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 -aider --models groq/ # #################################################### # -aider --model groq/llama3-70b-8192 --no-auto-commits +aider --models groq/ +export GROQ_API_KEY=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 +aider --model groq/llama3-70b-8192 --no-auto-commits --show-repo-map # OLLAMA? aider --openai-api-base https://ollama.d-popov.com --models openai/ \ No newline at end of file From a2457e8006a73293a6013d77f4a5c7bc061030bd Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Mon, 29 Jul 2024 18:20:51 +0300 Subject: [PATCH 23/23] notes --- dev/sample mermaid.mmd | 31 +++++++++++++++ linux/docker install.md | 4 ++ linux/setup forticlient.sh | 15 +++++++- python/appveyor.mmd | 41 ++++++++++++++++++++ python/deployments_graph.py | 29 +++++++++----- windows/wsl.cmd | 76 +++++++++++++++++++++++++++++++++++++ 6 files changed, 185 insertions(+), 11 deletions(-) create mode 100644 dev/sample mermaid.mmd create mode 100644 windows/wsl.cmd diff --git a/dev/sample mermaid.mmd b/dev/sample mermaid.mmd new file mode 100644 index 0000000..be830ac --- /dev/null +++ b/dev/sample mermaid.mmd @@ -0,0 +1,31 @@ +``` mermaid +graph TD + A[Common Configuration] --> B[master] + A[Common Configuration] --> C[stable] + A[Common Configuration] --> D[deployment] + A[Common Configuration] --> E[GAT-5073] + A[Common Configuration] --> F[GAT-5098] + + B --> B1[Release_ProfessionalTestServer] + B --> B2[Release_TestServer] + B --> B3[Release_DemoServer] + B1 --> G[TESTPRO on master] + B2 --> H[TEST on master] + B3 --> I[DEMO on master] + + C --> C1[Release_DemoServer] + C --> C2[Release_ProfessionalTestServer] + C1 --> J[DEMO on stable] + C2 --> K[TESTPRO on stable] + + D --> D1[Release_ProductionServer] + D --> D2[Release_ProfessionalServer] + D1 --> L[PROD Staging on deployment] + D2 --> M[PRO on deployment] + + E --> E1[Staging_TestServer] + E1 --> N[TEST-Staging on GAT-5073] + + F --> F1[Staging_DemoServer] + F1 --> O[DEMO-Staging on GAT-5098] +``` \ No newline at end of file diff --git a/linux/docker install.md b/linux/docker install.md index cac3c86..19b9101 100644 --- a/linux/docker install.md +++ b/linux/docker install.md @@ -28,3 +28,7 @@ sudo docker build -t your-image-name . # attach to container docker exec -it potainer /bin/sh +# on windows - setup port forwarding +#netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=9000 connectaddress=172.29.111.255 connectport=9000 +netsh interface portproxy add v4tov4 listenport=9000 listenaddress=0.0.0.0 connectport=9000 connectaddress=172.29.104.23 +netsh interface portproxy delete v4tov4 listenaddress=127.0.0.1 listenport=9000 diff --git a/linux/setup forticlient.sh b/linux/setup forticlient.sh index 80fe0bb..c2fe637 100644 --- a/linux/setup forticlient.sh +++ b/linux/setup forticlient.sh @@ -2,7 +2,20 @@ #wget https://filestore.fortinet.com/forticlient/forticlient_vpn_7.0.7.0246_amd64.deb apt update apt install -y openfortivpn ppp -openfortivpn vpn.gateway.one:10443 -u 'dobromir.popov@gateway.one' --trusted-cert bd26362cc802a27102fcdbf7e7e9328f3dede58aa44c125ede4aadb9e39da8c8 +openfortivpn vpn.gateway.one:10443 -u 'dobromir.popov@gateway.one' --trusted-cert bd26362cc802a27102fcdbf7e7e9328f3dede58aa44c125ede4aadb9e39da8c8 +U6n4A7^8^c7dX&p6s + + +or +nano /etc/openfortivpn/config +> +host = vpn.gateway.one +port = 10443 +trusted-cert = bd26362cc802a27102fcdbf7e7e9328f3dede58aa44c125ede4aadb9e39da8c8 +pppd-use-peerdns = 1 +set-routes = 1 +username = dobromir.popov@gateway.one +password = U6n4A7^8^c7dX&p6s #ERROR: pppd: The kernel does not support PPP, for example, the PPP kernel driver is not included or cannot be loaded. diff --git a/python/appveyor.mmd b/python/appveyor.mmd index 84ab1a8..dcbdd43 100644 --- a/python/appveyor.mmd +++ b/python/appveyor.mmd @@ -33,3 +33,44 @@ graph TD style C1 fill:#bbf,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5 style C2 fill:#bbf,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5 + + +%% graph TD +%% A[Branches] --> B[master] +%% A --> C[stable] +%% A --> D[deployment] +%% A --> E[GAT-5073] +%% A --> F[GAT-5098] + +%% B --> G[Release_ProfessionalTestServer] +%% B --> H[Release_DemoServer] + +%% C --> I[Release_DemoServer] +%% C --> J[Release_ProfessionalTestServer] + +%% D --> K[Release_ProductionServer] +%% D --> L[Release_ProfessionalServer] + +%% E --> M[Staging_TestServer] + +%% F --> N[Staging_DemoServer] + +%% G --> O[TESTPRO - production] +%% H --> P[DEMO - production] + +%% I --> Q[DEMO - production] +%% J --> R[TESTPRO - production] + +%% K --> S[PROD - staging] +%% L --> T[PRO - production] + +%% M --> U[TEST - staging] + +%% N --> V[DEMO - staging] + +%% style A fill:#f9f,stroke:#333,stroke-width:2px +%% style B fill:#bbf,stroke:#333,stroke-width:2px +%% style C fill:#bbf,stroke:#333,stroke-width:2px +%% style D fill:#bbf,stroke:#333,stroke-width:2px +%% style E fill:#bbf,stroke:#333,stroke-width:2px +%% style F fill:#bbf,stroke:#333,stroke-width:2px \ No newline at end of file diff --git a/python/deployments_graph.py b/python/deployments_graph.py index f6d9e0e..8eddfbd 100644 --- a/python/deployments_graph.py +++ b/python/deployments_graph.py @@ -34,10 +34,15 @@ if 'branches' in config: # Check for inactive branches and configurations in the comments lines = appveyor_yml.splitlines() for i, line in enumerate(lines): + # Check for commented branches if re.match(r'#\s*-\s*(\w+)', line): - inactive_configs.setdefault(lines[i-1].strip().split()[1], []).append(re.findall(r'#\s*-\s*(\w+)', line)[0].replace('-', '_')) - if line.strip().startswith('#') and i + 2 < len(lines) and 'branches:' in lines[i + 1] and 'only:' in lines[i + 2]: - inactive_branches.append(lines[i + 2].split(':')[1].strip().replace('-', '_')) + branch_name = re.findall(r'#\s*-\s*(\w+)', line)[0] + if 'branches' in lines[i - 1] and 'only:' in lines[i - 2]: + inactive_branches.append(branch_name.replace('-', '_')) + + # Check for commented configurations + if re.match(r'#\s*-\s*(\w+)', line): + inactive_configs.setdefault(lines[i - 1].strip().split()[1], []).append(re.findall(r'#\s*-\s*(\w+)', line)[0].replace('-', '_')) # Extract deployment configurations if 'deploy' in config: @@ -67,14 +72,18 @@ for branch in branches.keys(): for branch, configs in branches.items(): branch_id = branch.replace('-', '_') for idx, config in enumerate(configs): - config_id = f"{branch_id}{idx+1}" + config_id = f"{branch_id}{idx + 1}" mermaid_graph += f" {branch_id} --> {config_id}[{config}]\n" - # Add deployments to the configurations - for deploy in deployments.get(branch, []): - configuration = deploy.get('configuration') - if configuration == config: - service = deploy.get('service', '') - mermaid_graph += f" {config_id} --> {service_id}[{deploy.get('on', {}).get('configuration', '')} on {branch}]\n" + +# Add deployments to the configurations +for branch, deploys in deployments.items(): + branch_id = branch.replace('-', '_') + for deploy in deploys: + configuration = deploy.get('configuration') + if configuration: + config_id = f"{branch_id}{branches[branch].index(configuration) + 1}" + service_id = deploy.get('website', '').replace('-', '_') + mermaid_graph += f" {config_id} --> {service_id}[{deploy.get('provider', '')} on {branch}]\n" # Highlight inactive branches and configurations with a dotted style for branch in inactive_branches: diff --git a/windows/wsl.cmd b/windows/wsl.cmd new file mode 100644 index 0000000..769cdf8 --- /dev/null +++ b/windows/wsl.cmd @@ -0,0 +1,76 @@ +@REM run image (alpine) as root user + wsl -d Alpine -u root + + +@REM wsl install docker cuda +# Update the package list and install dependencies +sudo apt update +sudo apt install -y ca-certificates curl gnupg lsb-release + +# Add Docker’s official GPG key +sudo mkdir -p /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + +# Set up the Docker repository +echo \ +"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ +$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + +# Update the package list +sudo apt update + +# Install Docker Engine +sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + +# Start Docker +sudo service docker start + +# Enable Docker to start at boot +sudo systemctl enable docker + +# Allow Docker commands without sudo +sudo usermod -aG docker $USER + + +@REM Install WSL-Ubuntu Package for CUDA: + +@REM Follow the instructions to install the CUDA toolkit specifically designed for WSL. Do not install the default CUDA toolkit that includes the drivers. + + +wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin +sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600 +wget https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda-repo-wsl-ubuntu-12-2-local_12.2.0-1_amd64.deb +sudo dpkg -i cuda-repo-wsl-ubuntu-12-2-local_12.2.0-1_amd64.deb +sudo cp /var/cuda-repo-wsl-ubuntu-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/ +sudo apt-get update +sudo apt-get install cuda +Install NVIDIA Container Toolkit: + +@REM Set up the package repository and install the NVIDIA Container Toolkit: + +distribution=$(. /etc/os-release;echo $ID$VERSION_ID) +curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - +curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list + +sudo apt-get update +sudo apt-get install -y nvidia-docker2 + + +# Create/update Docker daemon configuration +mkdir -p /etc/docker +echo '{ + "runtimes": { + "nvidia": { + "path": "nvidia-container-runtime", + "runtimeArgs": [] + } + } +}' > /etc/docker/daemon.json + + +sudo systemctl restart docker + + +@REM Run a test container to ensure everything is set up correctly: + +sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi \ No newline at end of file