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