From 27645f5e6b1a1b09d4b4435a61137db0c49cbaa9 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Sat, 16 Dec 2023 21:36:53 +0000 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 cffa6a40bb36d04d7360194cd39965257888c404 Mon Sep 17 00:00:00 2001 From: popov Date: Fri, 2 Feb 2024 14:32:26 +0000 Subject: [PATCH 5/6] 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 6/6] 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"