Miscellaneous
Sébastien Helleu edited this page Nov 6, 2022
·
52 revisions
/set weechat.color.chat_nick_colors 88,94,100,64,28,29,30,24,18,54,90,89
/set weechat.color.chat_nick_colors 217,223,229,193,157,158,159,153,147,183,219,218
/key bind meta-+ /input insert /bind\x20; /input grab_key_command
/key bind meta-P /window scroll -1h
/key bind meta-N /window scroll +1h
/filter add changesamenick * irc_nick ^(\S+) is now known as \1$
/filter add backlogtidy * logger_backlog ^\S+ \(\S+\) has (joined|left|quit) |^\S+ is now known as \S+$
/cursor go status ; /cursor move up ; /cursor move area_right ; /cursor move up ; /cursor move up
/window swap -window 2 right
/eval /set weechat.look.hotlist_prefix "${color:red}H: "
/eval /set weechat.look.prefix_same_nick ${color:${weechat.color.chat_nick_suffix}}${weechat.look.nick_suffix}
tar --exclude ~/.weechat/logs -acvf ~/weechat-backup-$(date +%y-%m-%d).tar.gz ~/.weechat
/exec -sh -bg tar --exclude ~/.weechat/logs -acvf ~/weechat-backup-$(date +%y-%m-%d).tar.gz ~/.weechat
## Environment
# To avoid having to type absolute paths, append output of `printf "$PATH"`
PATH=
# Locale you wish to use
LANG=fi_FI.UTF-8
# Timezone
TZ=Europe/Helsinki
# The actual autostart magic
@reboot sleep 300 && tmux -2u new-session -s auto -d weechat
-
@reboot
= tell cron to do this on reboot -
sleep 300
= the shell where I intent to use this primarily is using NFS and I think it’s reasonable to expect everything to be mounted in five minutes. -
tmux -2u
= force enable 256 colors & UTF-8 -
new-session -s auto -d weechat
= start a new session with nameauto
(as in automatically started), detach it and run commandweechat
in it
- I assume logger.file.mask="$plugin.$name/%Y/%m/%d.log"
- Clean up per day logs manually after this script has run successfully
- Have backups, be careful and improve this script :)
cd ~/.weechat/logs/
for ITEM in */ ; do
for YEAR in $(seq 2014 2017) ; do
test -d "$ITEM/$YEAR" || continue
test -f "$ITEM/$YEAR.log" && continue
echo -n "${ITEM%%/*} :: $YEAR :: " >&2
for MONTH in $(seq -f "%02.0f" 1 12) ; do
test -d "$ITEM/$YEAR/$MONTH" || continue
echo -n -e "\b\b\b\b\b\b$MONTH :: " >&2
for DAY in $(seq -f "%02.0f" 01 31) ; do
test -f "$ITEM/$YEAR/$MONTH/$DAY.log" \
&& cat "$ITEM/$YEAR/$MONTH/$DAY.log"
done
done > "$ITEM/$YEAR.log"
echo -e "\b\b\b\b\b\bdone ($(du -h "$ITEM/$YEAR.log" |sed -e 's,\s.*,,'))" >&2
done
done
This will show a log file excluding lines that have --
, <--
, or -->
in the third column.
It also optional can take a start and end date to filter the range it will show from.
(This outputs to stdout and does not modify the log file, so you can pipe, or redirect the output wherever you need.)
#!/bin/sh
#==========================
#
# TODO:
# 1. Add checks for correct date format, trigger showHelp if bad
#
#==========================
showHelp() {
printf '==== Weechat Log Filter ====\n\n'
printf 'Usage: %s <log file> [start date] [end date]\n\n' "$(basename "${0}")"
printf 'Start and end dates should be in dashed ISO 8601 Format\n Example: 2018-01-01\n\n'
}
case "${1}" in
"-h"|"--help")
showHelp
exit 0
;;
esac
if [ -n "${1}" ] && [ -f "${1}" ]; then
if [ -n "${2}" ]; then
if [ -n "${3}" ]; then
awk \
-v startdate="${2}" \
-v enddate="${3}" \
'$3 !~ "<?-->?" && $1>=startdate && $1<=enddate {print $0}' "${1}"
else
awk \
-v startdate="${2}" \
'$3 !~ "<?-->?" && $1>=startdate {print $0}' "${1}"
fi
else
awk '$3 !~ "<?-->?" { print $0 }' "${1}"
fi
else
echo "File Not Specified or Specified File Does Not Exist"
fi
alias weechat='ZNCPASS=$(dialog --passwordbox "Enter ZNC Bouncer Password" 0 0 3>&1- 1>&2- 2>&3-) ; weechat -t -r "/set irc.server_default.ssl_verify off ; /server add freenode ${ZNC_SERVER_IP}/${ZNC_SERVER_PORT} -ssl -username=${YOUR_USERNAME}/freenode -password=${YOUR_ZNC_PASSWORD} -autoconnect"'
IMPORTANT: all these items are for WeeChat ≤ 3.5. For WeeChat ≥ 3.6 use the /item
command.
/set plugins.var.python.text_item.filter_item "!all|*filters* ${if:${info:filters_enabled}==1?${color:yellow}F:${color:243}F}${if:${buffer.filter}==1?${color:yellow}@:${color:243}@}"
/set plugins.var.python.text_item.relay_count "all|relay_client_* ${info:relay_client_count,connected}"
/set plugins.var.python.text_item.my_away "!all|buffer_switch ${if:${away}!=0?${color:gray}zZzZ}"
/set plugins.var.python.text_item.dimension "all|signal_sigwinch width: ${info:term_width} height: ${info:term_height}"
/set plugins.var.python.text_item.my_scroll "!all|window_scrolled ${if:${window.scroll.lines_after}==0?:${color:*yellow}${window.scroll.lines_after}}"
/set plugins.var.python.text_item.loglevel "all|buffer_switch ${if:${logger.level.${window.buffer.full_name}}>0?${logger.level.${window.buffer.full_name}}:}"
For Weechat <= 3.1:
/set plugins.var.python.text_item.cursor_mode "all|key_combo_cursor ${if:${info:cursor_mode}==1?${color:yellow}C}"
For WeeChat ≥ 3.2 (less CPU usage!):
/set plugins.var.python.text_item.cursor_mode "all|cursor_* ${if:${info:cursor_mode}==1?${color:yellow}C}"
The dict indicator will also show the status of the spell plugin (enabled|disabled) (item name: 'my_spell_dict')
/set plugins.var.python.text_item.my_spell_dict "!all|buffer_switch ${if:${eval:${spell.dict.${buffer.full_name}}}!=''?${if:${eval:${spell.check.enabled}}==1?${color:yellow}${eval:${spell.dict.${buffer.full_name}}}:${color:238}${eval:${spell.dict.${buffer.full_name}}}}:}"