mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-11 19:45:25 +03:00
feat: image links
This commit is contained in:
parent
ba92551ade
commit
78ecd7e1bb
6 changed files with 3 additions and 232 deletions
|
|
@ -60,16 +60,13 @@ Some of the notable programs are listed in the table below.
|
||||||
|
|
||||||
* Some statistics
|
* Some statistics
|
||||||
If you are viewing the file in Emacs, eval the following to show the pictures with reasonable width:
|
If you are viewing the file in Emacs, eval the following to show the pictures with reasonable width:
|
||||||
#+begin_src elisp :results none
|
|
||||||
(setq-local org-image-actual-width '(1024))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** History
|
** History
|
||||||
[[./dot-stats/img/all.png]]
|
[[https://sqrtminusone.xyz/stats/all.png]]
|
||||||
|
|
||||||
[[./dot-stats/img/emacs-vim.png]]
|
[[https://sqrtminusone.xyz/stats/emacs-vim.png]]
|
||||||
|
|
||||||
[[./dot-stats/img/literate-config.png]]
|
[[https://sqrtminusone.xyz/stats/literate-config.png]]
|
||||||
|
|
||||||
* Misc
|
* Misc
|
||||||
** Notes
|
** Notes
|
||||||
|
|
|
||||||
|
|
@ -1,202 +0,0 @@
|
||||||
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="https://gongzhitaao.org/orgcss/org.css"/>
|
|
||||||
#+PROPERTY: header-args:sh :session files-history
|
|
||||||
#+PROPERTY: header-args:python :session files-history
|
|
||||||
#+PROPERTY: header-args:python+ :exports both
|
|
||||||
#+PROPERTY: header-args:python+ :tangle yes
|
|
||||||
#+PROPERTY: header-args:python+ :async yes
|
|
||||||
#+PROPERTY: header-args:python+ :kernel python3
|
|
||||||
|
|
||||||
#+begin_src elisp :exports none
|
|
||||||
(setq-local org-image-actual-width '(1024))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
| 1024 |
|
|
||||||
|
|
||||||
* Get the data
|
|
||||||
** Commit history
|
|
||||||
#+begin_src sh
|
|
||||||
REPO='/home/pavel/.local/share/yadm/repo.git'
|
|
||||||
|
|
||||||
if [ ! -d "data" ]; then
|
|
||||||
mkdir data
|
|
||||||
fi
|
|
||||||
|
|
||||||
# echo hash,time > data/commits.csv
|
|
||||||
# git -C $REPO log --pretty="%H,%cI" >> data/commits.csv
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
** File lengths
|
|
||||||
#+begin_src sh
|
|
||||||
declare -A paths
|
|
||||||
|
|
||||||
keys=("Emacs.org" "init.el" "init.vim" "Desktop.org" "Console.org" "Mail.org" "Guix.org")
|
|
||||||
|
|
||||||
paths["Emacs.org"]="Emacs.org;.emacs.d/emacs.org;config/.emacs.d/emacs.org"
|
|
||||||
paths["init.el"]=".emacs.d/init.el;config/.emacs.d/init.el"
|
|
||||||
paths["init.vim"]=".config/nvim/init.vim;config/nvim/init.vim;nvim/init.vim"
|
|
||||||
paths["Desktop.org"]="Desktop.org"
|
|
||||||
paths["Console.org"]="Console.org"
|
|
||||||
paths["Guix.org"]="Guix.org"
|
|
||||||
paths["Mail.org"]="Mail.org"
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
|
|
||||||
#+begin_src sh :results output verbatim
|
|
||||||
get_lengths () {
|
|
||||||
while IFS=' ' read commit date; do
|
|
||||||
|
|
||||||
result="$commit,$date"
|
|
||||||
|
|
||||||
for key in "${keys[@]}"
|
|
||||||
do
|
|
||||||
val=0
|
|
||||||
IFS=';' read -r -a files <<< "${paths[$key]}"
|
|
||||||
for file in "${files[@]}"
|
|
||||||
do
|
|
||||||
if (( val == 0 )); then
|
|
||||||
val=$(git -C $REPO show $commit:$file 2>/dev/null | wc -l || 0)
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
result+=",$val"
|
|
||||||
done
|
|
||||||
# result=${result%,*}
|
|
||||||
echo $result
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $(git -C $REPO log --pretty="%H %cI" | head -n 1 | get_lengths)
|
|
||||||
echo $(git -C $REPO log --pretty="%H %cI" | tail -n 1 | get_lengths)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
:
|
|
||||||
: > > > > > > > > > > > > > > > > > > > sh-5.0$ sh-5.0$ c14a738f2abfa813b56e90745e99f5e13a770459,2021-10-01T18:49:37+03:00,5573,3705,1053,2480,1008,535,706
|
|
||||||
: 5044283019dc34c95d2836485ed492b34f49230e,2019-03-31T13:52:50+03:00,0,0,62,0,0,0,0
|
|
||||||
|
|
||||||
#+begin_src sh :results output verbatim
|
|
||||||
header="commit,date"
|
|
||||||
for key in "${keys[@]}"
|
|
||||||
do
|
|
||||||
header+=",$key"
|
|
||||||
done
|
|
||||||
echo $header > data/lengths.csv
|
|
||||||
git -C $REPO log --pretty="%H %cI" | get_lengths >> data/lengths.csv
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
|
|
||||||
* Plot
|
|
||||||
** Load the data
|
|
||||||
#+begin_src python
|
|
||||||
from datetime import datetime
|
|
||||||
from matplotlib import pyplot as plt
|
|
||||||
from IPython.display import display
|
|
||||||
|
|
||||||
import matplotlib as mpl
|
|
||||||
import numpy as np
|
|
||||||
import pandas as pd
|
|
||||||
|
|
||||||
mpl.rcParams['figure.dpi'] = 125
|
|
||||||
mpl.rcParams['hatch.linewidth'] = 4.0
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
|
|
||||||
#+begin_src python
|
|
||||||
plt.style.use('./palenight.mplstyle')
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
|
|
||||||
#+begin_src python
|
|
||||||
def remove_zeros(data):
|
|
||||||
last = -1
|
|
||||||
result = []
|
|
||||||
for datum in data:
|
|
||||||
if last <=0 and datum > 0:
|
|
||||||
if len(result) > 0:
|
|
||||||
result[-1] = 0
|
|
||||||
result.append(datum)
|
|
||||||
last = datum
|
|
||||||
elif last <= 0 and datum <= 0:
|
|
||||||
result.append(np.nan)
|
|
||||||
elif last > 0 and datum <= 0:
|
|
||||||
result.append(last)
|
|
||||||
else:
|
|
||||||
result.append(datum)
|
|
||||||
last = datum
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
test = [0, 0, 0, 1, 2, 3, 0, 0, 4, 0, 0, 5, 1, 1, 6]
|
|
||||||
remove_zeros(test)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
| nan | nan | 0 | 1 | 2 | 3 | 3 | 3 | 4 | 4 | 4 | 5 | 1 | 1 | 6 |
|
|
||||||
|
|
||||||
#+begin_src python :pandoc t
|
|
||||||
df = pd.read_csv('./data/lengths.csv', parse_dates=['date'])
|
|
||||||
files = [c for c in df.columns if c not in ['commit', 'date']]
|
|
||||||
df = df[df[files].sum(axis=1) > 0]
|
|
||||||
df = df.drop('commit', axis=1)
|
|
||||||
df = df.sort_values('date').set_index('date')
|
|
||||||
df = df.apply(lambda col: remove_zeros(col) if col.name not in ['commit', 'date'] else col)
|
|
||||||
# df = df.replace(0, np.nan)
|
|
||||||
|
|
||||||
with pd.option_context('display.max_rows', 10):
|
|
||||||
display(df)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
:RESULTS:
|
|
||||||
| | Emacs.org | init.el | init.vim | Desktop.org | Console.org | Mail.org | Guix.org |
|
|
||||||
|---------------------------+-----------+---------+----------+-------------+-------------+----------+----------|
|
|
||||||
| date | | | | | | | |
|
|
||||||
| 2019-03-31 13:52:50+03:00 | NaN | NaN | 62 | NaN | NaN | NaN | NaN |
|
|
||||||
| 2019-03-31 20:06:29+03:00 | NaN | NaN | 62 | NaN | NaN | NaN | NaN |
|
|
||||||
| 2019-04-02 17:52:05+03:00 | NaN | NaN | 91 | NaN | NaN | NaN | NaN |
|
|
||||||
| 2019-04-03 10:36:35+03:00 | NaN | NaN | 91 | NaN | NaN | NaN | NaN |
|
|
||||||
| 2019-04-09 12:47:05+03:00 | NaN | NaN | 91 | NaN | NaN | NaN | NaN |
|
|
||||||
| ... | ... | ... | ... | ... | ... | ... | ... |
|
|
||||||
| 2021-09-22 11:55:05+03:00 | 5549.0 | 3697.0 | 1053 | 2480.0 | 1000.0 | 533.0 | 704.0 |
|
|
||||||
| 2021-09-30 19:13:31+03:00 | 5573.0 | 3705.0 | 1053 | 2480.0 | 1000.0 | 533.0 | 704.0 |
|
|
||||||
| 2021-09-30 19:14:03+03:00 | 5573.0 | 3705.0 | 1053 | 2480.0 | 1008.0 | 533.0 | 704.0 |
|
|
||||||
| 2021-09-30 19:15:18+03:00 | 5573.0 | 3705.0 | 1053 | 2480.0 | 1008.0 | 535.0 | 704.0 |
|
|
||||||
| 2021-10-01 18:49:37+03:00 | 5573.0 | 3705.0 | 1053 | 2480.0 | 1008.0 | 535.0 | 706.0 |
|
|
||||||
|
|
||||||
421 rows × 7 columns
|
|
||||||
:END:
|
|
||||||
|
|
||||||
** Plot Emacs vs vim
|
|
||||||
#+begin_src python :file img/emacs-vim.png
|
|
||||||
fig, ax = plt.subplots(figsize=(12, 6))
|
|
||||||
df[['Emacs.org', 'init.vim', 'init.el']].plot(ax=ax)
|
|
||||||
ax.grid(True, alpha=0.25)
|
|
||||||
ax.set_axisbelow(True)
|
|
||||||
ax.set_title('Emacs vs neovim config size growth')
|
|
||||||
ax.set_ylabel('LoC')
|
|
||||||
ax.text(0.075, 0.08, f'upd. {datetime.now().strftime("%Y-%m-%d")}', transform=fig.transFigure, va='top', ha='left')
|
|
||||||
pass
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
[[file:img/emacs-vim.png]]
|
|
||||||
|
|
||||||
** Plot literate configuration
|
|
||||||
#+begin_src python :file img/literate-config.png
|
|
||||||
fig, ax = plt.subplots(figsize=(12, 6))
|
|
||||||
df[['Emacs.org', 'Desktop.org', 'Mail.org', 'Guix.org', 'Console.org']].plot(ax=ax)
|
|
||||||
ax.grid(True, alpha=0.25)
|
|
||||||
ax.set_axisbelow(True)
|
|
||||||
ax.set_title('Literate configuration size growth')
|
|
||||||
ax.set_ylabel('LoC')
|
|
||||||
ax.text(0.075, 0.08, f'upd. {datetime.now().strftime("%Y-%m-%d")}', transform=fig.transFigure, va='top', ha='left')
|
|
||||||
pass
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
[[file:img/literate-config.png]]
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 114 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 59 KiB |
|
|
@ -1,24 +0,0 @@
|
||||||
### FONT
|
|
||||||
text.color: D0D0D0
|
|
||||||
|
|
||||||
### AXES
|
|
||||||
axes.facecolor: 363B52
|
|
||||||
axes.edgecolor: FFFFFF
|
|
||||||
axes.labelcolor: FFFFFF
|
|
||||||
axes.prop_cycle: cycler('color', ['f07178', 'c3e88d', 'ffcb6b', '82aaff', 'c792ea', '89ddff', 'd0d0d0', '434758', 'ff8b92', 'ddffa7', 'ffe585', '9cc4ff', 'e1acff', 'a3f7ff'])
|
|
||||||
|
|
||||||
### TICKS
|
|
||||||
xtick.color: FFFFFF
|
|
||||||
ytick.color: FFFFFF
|
|
||||||
|
|
||||||
### GRIDS
|
|
||||||
grid.color: FFFFFF
|
|
||||||
|
|
||||||
### Legend
|
|
||||||
legend.facecolor: inherit
|
|
||||||
legend.edgecolor: C792EA
|
|
||||||
|
|
||||||
### FIGURE
|
|
||||||
|
|
||||||
figure.facecolor: 292D3E
|
|
||||||
savefig.facecolor: 292D3E
|
|
||||||
Loading…
Add table
Reference in a new issue