Commit 0e208c8601

0e208c86010343086eeb96b2f69c7329c03aecae

parent: 504e8fbde8

Unsigned

cmc <hello@cleberg.net> · 2024-10-31 15:05 UTC

minor enhancements

Layout: unified · split

README.org +40 −25
@@ -1,19 +1,22 @@
1* cleberg.net 1#+title: README
2
3[[https://cleberg.net][cleberg.net]] is my personal webpage and blog.
4 2
5** Overview 3* cleberg.net
6 4
7This website & blog uses [[https://orgmode.org/][Org-Mode]], published with [[https://github.com/emacs-love/weblorg][weblorg]]. 5[[https://cleberg.net][cleberg.net]] is my personal webpage and blog. This website and blog utilize the
6powerful Org-Mode publishing system, courtesy of the [[https://github.com/emacs-love/weblorg][weblorg]] Emacs package.
8 7
9** Configuration 8** Features & Configuration
10 9
11All configuration options are available within the =publish.el= file. Refer to 10This site leverages the flexibility of Org-Mode to allow for easy customization
12the weblorg documentation for further configuration options. 11through a simple =publish.el= file. For those who are interested in tweaking the
12underlying configuration, the weblorg documentation provides all necessary
13details on possible settings and options.
13 14
14** Building & Publishing 15** Getting Started with cleberg.net
15 16
16Local testing is available via [[https://www.gnu.org/software/emacs/][Emacs]] or through the command line. 17To begin exploring or contributing to this project, you'll first need to set up
18a local copy of the repository. This can be accomplished by running the
19following commands within Emacs:
17 20
18#+begin_src sh 21#+begin_src sh
19git clone https://git.cleberg.net/cleberg.net.git && \ 22git clone https://git.cleberg.net/cleberg.net.git && \
@@ -21,32 +24,44 @@ cd cleberg.net && \
21emacs -nw 24emacs -nw
22#+end_src 25#+end_src
23 26
24Within Emacs, open any of the repository files. In Doom, I do this with =Spc f 27#+RESULTS:
25f= and selecting =README.org=. Make any changes necessary to customize the 28
26project. 29Alternatively, if you prefer working with Doom, simply open any of the
30repository files using =Spc f f= and selecting =README.org=. From there, feel
31free to make any necessary changes or customizations.
27 32
28To publish, you can use the =build.sh= script (change the deployment target!) or 33** Building & Publishing the Site
29you can run the following commands. 34
35To test the site locally within Emacs, run the following command sequence:
30 36
31Use the =ENV= environment variable to determine which base URL weblorg will use. 37Use the =ENV= environment variable to determine which base URL weblorg will use.
32If ENV is ommitted, it will default to =localhost:8000=. If =ENV=prod=, weblorg 38If ENV is omitted, it will default to =localhost:8000=. If =ENV=prod=, weblorg
33will look in the =publish.el= file for the production base URL. 39will look in the =publish.el= file for the production base URL.
34 40
35#+begin_src sh 41#+begin_src sh
36ENV=prod emacs --script publish.el 42ENV=prod emacs --script publish.el
37#+end_src 43#+end_src
38 44
39The files will be published to the =.build= directory. You can deploy these 45The resulting files can then be deployed to your desired target using any method
40files to the target through any number of methods, such as =scp= or SFTP. 46of your choice, such as =scp= or SFTP.
47
48Alternatively, you may prefer to utilize the provided =build.sh= script to
49automate this process. To do so, simply customize and run the script as needed.
50
51*** Creating New Blog Posts
41 52
42Alternatively, customize and run the =build.sh= script as needed. 53To quickly create a new blog post within Emacs, follow these steps:
43 54
44*** Tips 551. Run =C-x C-f= (=SPC f f= in Doom) to open a new Org-Mode file.
562. Utilize the =insert-file-contents= command by pressing =C-x i=.
573. Direct the contents of =template.org= (located at =utils/template.org=) into
58 the newly opened file.
45 59
46You can quickly create a new blog post by running =C-x C-f= (=SPC f f= in Doom), 60This streamlined process allows you to rapidly generate fresh content for
47running =C-x i= (=insert-file-contents=), and then direct it to the 61cleberg.net, taking advantage of the existing template structure and formatting.
48=template.org= file (e.g., =~/git/cleberg.net/utils/template.org=).
49 62
50** Tasks 63** Contributing & Tasks
51 64
52Refer to the [[https://github.com/ccleberg/cleberg.net/issues][issues page]] for open tickets or to submit a new ticket. 65For those interested in contributing to this project or addressing any
66outstanding issues, please refer to the [[https://github.com/ccleberg/cleberg.net/issues][issues page]]. This is where you can find
67a comprehensive list of open tickets or submit a new ticket for consideration.
utils/salary_visualization.py +34 −11
@@ -1,19 +1,29 @@
1""" 1"""
2A file that will visualize salary data from an incoming CSV. 2A file that will visualize salary data from an incoming CSV.
3
4This script reads a CSV file containing salary data and visualizes it using
5plotly.
3""" 6"""
4 7
5import locale 8import locale
9from pandas import read_csv as pd_read_csv
6import pandas as pd 10import pandas as pd
7import plotly.graph_objs as go 11import plotly.graph_objs as go
8 12
9locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') 13locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
10 14
11df = pd.read_csv('~/git/cleberg.net/static/salary.csv') 15# Read the CSV file
16df = pd_read_csv('~/git/cleberg.net/theme/static/salary.csv')
12 17
13# Function to format salary as US currency 18def format_currency(value: float) -> str:
14def format_currency(value):
15 """ 19 """
16 Format values in USD currency format. 20 Format values in USD currency format.
21
22 Args:
23 value (float): The value to be formatted.
24
25 Returns:
26 str: The formatted value.
17 """ 27 """
18 return f"${value:,.2f}" 28 return f"${value:,.2f}"
19 29
@@ -23,25 +33,37 @@ df = df.iloc[::-1].reset_index(drop=True)
23# Calculate the percentage increase 33# Calculate the percentage increase
24df['Percentage Increase'] = df['Salary'].pct_change() * 100 34df['Percentage Increase'] = df['Salary'].pct_change() * 100
25 35
26# Initialize the plot 36def create_trace(row: pd.Series) -> go.Scatter:
27fig = go.Figure() 37 """
38 Create a scatter plot trace for a single row.
28 39
29# Adding each data point as a separate trace to display the text 40 Args:
30for index, row in df.iterrows(): 41 row (pd.Series): The row to be plotted.
31 TITLE_COMPANY = f"{row['Title']} ({row['Company']})" 42
43 Returns:
44 go.Scatter: The created scatter plot trace.
45 """
46 title_company = f"{row['Title']} ({row['Company']})"
32 salary_formatted = format_currency(row['Salary']) 47 salary_formatted = format_currency(row['Salary'])
33 if pd.notna(row['Percentage Increase']): 48 if pd.notna(row['Percentage Increase']):
34 text = f"{salary_formatted} ({row['Percentage Increase']:.2f}%)" 49 text = f"{salary_formatted} ({row['Percentage Increase']:.2f}%)"
35 else: 50 else:
36 text = salary_formatted 51 text = salary_formatted
37 fig.add_trace(go.Scatter( 52 return go.Scatter(
38 x=[row['Start'], row['End']], 53 x=[row['Start'], row['End']],
39 y=[row['Salary'], row['Salary']], 54 y=[row['Salary'], row['Salary']],
40 text=[text], 55 text=[text],
41 mode='lines+text', 56 mode='lines+text',
42 name=TITLE_COMPANY, 57 name=title_company,
43 textposition='top center' 58 textposition='top center'
44 )) 59 )
60
61# Initialize the plot
62fig = go.Figure()
63
64# Add each data point as a separate trace to display the text
65for index, row in df.iterrows():
66 fig.add_trace(create_trace(row))
45 67
46# Update visual styles of the figure 68# Update visual styles of the figure
47fig.update_layout( 69fig.update_layout(
@@ -60,4 +82,5 @@ fig.update_layout(
60 height=800 82 height=800
61) 83)
62 84
85# Display the plot
63fig.show() 86fig.show()