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
2
3[[https://cleberg.net][cleberg.net]] is my personal webpage and blog.
1#+title: README
42
5** Overview
3* cleberg.net
64
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.
87
9** Configuration
8** Features & Configuration
109
11All configuration options are available within the =publish.el= file. Refer to
12the weblorg documentation for further configuration options.
10This site leverages the flexibility of Org-Mode to allow for easy customization
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.
1314
14** Building & Publishing
15** Getting Started with cleberg.net
1516
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:
1720
1821#+begin_src sh
1922git clone https://git.cleberg.net/cleberg.net.git && \
@@ -21,32 +24,44 @@ cd cleberg.net && \
2124emacs -nw
2225#+end_src
2326
24Within Emacs, open any of the repository files. In Doom, I do this with =Spc f
25f= and selecting =README.org=. Make any changes necessary to customize the
26project.
27#+RESULTS:
28
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.
2732
28To publish, you can use the =build.sh= script (change the deployment target!) or
29you can run the following commands.
33** Building & Publishing the Site
34
35To test the site locally within Emacs, run the following command sequence:
3036
3137Use 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
3339will look in the =publish.el= file for the production base URL.
3440
3541#+begin_src sh
3642ENV=prod emacs --script publish.el
3743#+end_src
3844
39The files will be published to the =.build= directory. You can deploy these
40files to the target through any number of methods, such as =scp= or SFTP.
45The resulting files can then be deployed to your desired target using any method
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
4152
42Alternatively, customize and run the =build.sh= script as needed.
53To quickly create a new blog post within Emacs, follow these steps:
4354
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.
4559
46You can quickly create a new blog post by running =C-x C-f= (=SPC f f= in Doom),
47running =C-x i= (=insert-file-contents=), and then direct it to the
48=template.org= file (e.g., =~/git/cleberg.net/utils/template.org=).
60This streamlined process allows you to rapidly generate fresh content for
61cleberg.net, taking advantage of the existing template structure and formatting.
4962
50** Tasks
63** Contributing & Tasks
5164
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 @@
11"""
22A 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.
36"""
47
58import locale
9from pandas import read_csv as pd_read_csv
610import pandas as pd
711import plotly.graph_objs as go
812
913locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
1014
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')
1217
13# Function to format salary as US currency
14def format_currency(value):
18def format_currency(value: float) -> str:
1519 """
1620 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.
1727 """
1828 return f"${value:,.2f}"
1929
@@ -23,25 +33,37 @@ df = df.iloc[::-1].reset_index(drop=True)
2333# Calculate the percentage increase
2434df['Percentage Increase'] = df['Salary'].pct_change() * 100
2535
26# Initialize the plot
27fig = go.Figure()
36def create_trace(row: pd.Series) -> go.Scatter:
37 """
38 Create a scatter plot trace for a single row.
2839
29# Adding each data point as a separate trace to display the text
30for index, row in df.iterrows():
31 TITLE_COMPANY = f"{row['Title']} ({row['Company']})"
40 Args:
41 row (pd.Series): The row to be plotted.
42
43 Returns:
44 go.Scatter: The created scatter plot trace.
45 """
46 title_company = f"{row['Title']} ({row['Company']})"
3247 salary_formatted = format_currency(row['Salary'])
3348 if pd.notna(row['Percentage Increase']):
3449 text = f"{salary_formatted} ({row['Percentage Increase']:.2f}%)"
3550 else:
3651 text = salary_formatted
37 fig.add_trace(go.Scatter(
52 return go.Scatter(
3853 x=[row['Start'], row['End']],
3954 y=[row['Salary'], row['Salary']],
4055 text=[text],
4156 mode='lines+text',
42 name=TITLE_COMPANY,
57 name=title_company,
4358 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))
4567
4668# Update visual styles of the figure
4769fig.update_layout(
@@ -60,4 +82,5 @@ fig.update_layout(
6082 height=800
6183)
6284
85# Display the plot
6386fig.show()