View Source Chr (CHR v0.2.2)
Chr module
Summary
Functions
busiest day
Daily Activity
return command history
pick up command from history record
pick up date from DateTime
pick up directory from history record
pick up time from DateTime
pick up date from history record
pick weekday from DateTime
timestamp to datetime
top commands
top directories
Weekly Activity
Functions
busiest day
Daily Activity
Examples
iex> Chr.daily_activity([": 1709957744:0;cat .zsh_history",": 1709968544:0;cat .zsh_history", ": 1710000944:0;cat .zsh_history"])
[
{"01", 20},
{"02", 0},
{"03", 0},
{"04", 0},
{"05", 0},
{"06", 0},
{"07", 0},
{"08", 0},
{"09", 0},
{"10", 0},
{"11", 0},
{"12", 0},
{"13", 20},
{"14", 0},
{"15", 0},
{"16", 20},
{"17", 0},
{"18", 0},
{"19", 0},
{"20", 0},
{"21", 0},
{"22", 0},
{"23", 0},
{"24", 0}
]
return command history
pick up command from history record
Examples
iex> Chr.pick_up_command(": 1707397937:0;cat ~/.zsh_history")
"cat"
iex> Chr.pick_up_command(": 1707397937:0;clear")
"clear"
pick up date from DateTime
Examples
iex> Chr.pick_up_date(~U[2021-03-31 00:00:00Z])
~D[2021-03-31]
pick up directory from history record
Examples
iex> Chr.pick_up_directory(": 1707397937:0;cd ~/projects/chr")
"~/projects/chr"
pick up time from DateTime
pick up date from history record
Examples
iex> Chr.pick_up_local_datetime(": 1707397937:0;cat ~/.zsh_history")
~U[2024-02-08 22:12:17Z]
pick weekday from DateTime
Examples
iex> Chr.pick_up_weekday(~U[2021-03-31 00:00:00Z])
3
timestamp to datetime
Examples
iex> Chr.timestamp_to_datetime("1617226800")
~U[2021-03-31 21:40:00Z]
@spec timezone_offset() :: integer()
top commands
top directories
Weekly Activity
Examples
iex> Chr.weekly_activity([": 1709957744:0;cat .zsh_history",": 1710044144:0;cat .zsh_history"])
[monday: 0, tuesday: 0, wednesday: 0, thursday: 0, friday: 0, saturday: 20, sunday: 20]