update
This commit is contained in:
parent
73fa6cf1b6
commit
ffd27dd111
@ -57,18 +57,30 @@ function contact_split {
|
||||
local card_guid
|
||||
declare -a card_lines
|
||||
|
||||
uid_found=false
|
||||
while read line; do
|
||||
if [[ "$line" =~ ^END:VCARD ]]; then
|
||||
if ! $uid_found ; then
|
||||
card_lines=("${card_lines[@]}" "UID:$(uid)")
|
||||
fi
|
||||
fi
|
||||
# Append each line to the end of this array.
|
||||
card_lines=("${card_lines[@]}" "$line")
|
||||
|
||||
# Get the contact's GUID, this becomes the file name.
|
||||
if [[ "$line" =~ ^N: ]]; then
|
||||
if [[ "$line" =~ ^FN: ]]; then
|
||||
card_guid=$(echo -n "$line" | cut -d ':' -f 2)
|
||||
fi
|
||||
|
||||
# Remember if we found an uid
|
||||
if [[ "$line" =~ ^UID: ]]; then
|
||||
uid_found=true
|
||||
fi
|
||||
|
||||
# This is the end of the card, so output it.
|
||||
if [[ "$line" =~ ^END:VCARD ]]; then
|
||||
printf "%s\n" "${card_lines[@]}" > "$dest/$(echo -n "$card_guid" | sed 's/;/_/g' | tr 'A-Z' 'a-z' | tr -d '\r').vcf"
|
||||
uid_found=false
|
||||
printf "%s\n" "${card_lines[@]}" > "$dest/$(echo -n "$card_guid" | sed 's/;/_/g' | tr 'A-Z' 'a-z' | tr -d '\r
').vcf"
|
||||
unset -v card_lines
|
||||
fi
|
||||
done
|
||||
@ -419,15 +431,17 @@ IFS=$ORIG_IFS
|
||||
}
|
||||
|
||||
|
||||
##### Main #####
|
||||
# MAIN FUNCTION
|
||||
phone_to_vcf () {
|
||||
# Copy contacts from phone via adb and convert them to vcf
|
||||
tmp="$(mktemp -d)"
|
||||
|
||||
tmp="$(mktemp -d)"
|
||||
echo "Get db from phone"
|
||||
adb pull /data/data/com.android.providers.contacts/databases/contacts2.db "$tmp"
|
||||
|
||||
echo "Get db from phone"
|
||||
adb pull /data/data/com.android.providers.contacts/databases/contacts2.db "$tmp"
|
||||
echo "Convert it to multiple vcard files"
|
||||
dump-contacts2db "$tmp/contacts2.db" | contact_split "${1:-$HOME/.contacts/vcards}"
|
||||
|
||||
echo "Convert it to multiple vcard files"
|
||||
dump-contacts2db "$tmp/contacts2.db" | contact_split "${1:-$HOME/.contacts/vcards}"
|
||||
|
||||
echo "Clean"
|
||||
rm -r "$tmp"
|
||||
echo "Clean"
|
||||
rm -r "$tmp"
|
||||
}
|
||||
|
@ -5,21 +5,34 @@ tmp="$(mktemp)"
|
||||
final="$(mktemp)"
|
||||
|
||||
sed \
|
||||
-e 's/adj/\n**Aujourd’hui**\n/' \
|
||||
-e 's/^hier/\n**Hier**\n/' \
|
||||
-e 's/^diffic.*/\n**Difficultés**\n/i' \
|
||||
-e 's/ / /g' \
|
||||
-e 's/^adj */\n\n**Cet après-midi**/' \
|
||||
-e 's/^aprem */\n\n**Cet après-midi**/' \
|
||||
-e 's/^matin */\n\n**Ce matin**/' \
|
||||
-e 's/^hier */\n\n**Hier après-midi**/' \
|
||||
-e 's/\( \|^\)maj\( \|$\)/mise à jour/' \
|
||||
-e 's/^diffic.*/\n\n**Difficultés**\n/i' \
|
||||
-e 's/^ *information.*/# Points divers/i' \
|
||||
-e 's/^point.* diver.*/# Points divers/i' \
|
||||
-e 's/^\([^-*#@:][^*#@:]\+\) \+:/- \U\1 :/' \
|
||||
-e 's/^point.* g.n.raux.*/# Points divers/i' \
|
||||
-e 's/^info.* g.n.ra.*/# Points divers/i' \
|
||||
-e 's/^difficult.s.*/# Difficultés/i' \
|
||||
-e 's/^message.* g.n.raux.*/# Points divers/i' \
|
||||
-e 's/^tickets$/dbm : tickets/g' \
|
||||
-e 's/^\([^-*#: ]\+\)$/# @\U\1/' \
|
||||
-e 's/^\([^-*#@: ][^*#@:]\+[^: ]\) *: */- \U\1 : /' \
|
||||
-e 's/^\([^-*#@:]\+\)$/- \1/' \
|
||||
-e 's/ \+/ /g' \
|
||||
-e 's/dde/demande/g' \
|
||||
-e 's/pb/problème/g' \
|
||||
"$f" > "$tmp"
|
||||
|
||||
sed -i -e 's/^\([^-*#\s]\)/# @\U\1/' "$tmp"
|
||||
#sed -i -e 's/^\([^-*#\s ]\)/# @\U\1/' "$tmp"
|
||||
|
||||
echo "
|
||||
**Daily Stand-Up Meeting du $(date '+%d %h %Y')**
|
||||
- Où : BBB/standup
|
||||
- Où : https://bbb.dbm.tech/rooms/05n-3ax-qwg-9n8/join
|
||||
- Participants : $(grep -o '@.*' "$tmp" | tr '\n' ',' | sed 's/,$/\n/')
|
||||
- Quand : $(date '+%Y/%m/%d') 9:45
|
||||
- Quand : $(date '+%Y/%m/%d') 12h05
|
||||
- Durée : 00:15 '(+0mn)
|
||||
- Scribe : Adrian
|
||||
- Relecteur :
|
||||
|
13
gw.sh
13
gw.sh
@ -10,27 +10,28 @@ root_or_die
|
||||
|
||||
local_iface="$1"
|
||||
net_iface="$2"
|
||||
net="192.168.99"
|
||||
|
||||
run sysctl net.ipv4.ip_forward=1
|
||||
clean "sysctl net.ipv4.ip_forward=1"
|
||||
#clean "sysctl net.ipv4.ip_forward=1"
|
||||
|
||||
run nmcli device set "$local_iface" managed no
|
||||
clean "nmcli device set "$local_iface" managed yes"
|
||||
|
||||
run ip a add 192.168.238.254/24 dev "$local_iface"
|
||||
clean "ip a del 192.168.238.254/24 dev $local_iface"
|
||||
run ip a add $net.254/24 dev "$local_iface"
|
||||
clean "ip a del $net.254/24 dev $local_iface"
|
||||
|
||||
# For dhcp offers
|
||||
run iptables -A OUTPUT -d 255.255.255.255/32 -j ACCEPT
|
||||
|
||||
run iptables -A OUTPUT -d 192.168.238.0/24 -j ACCEPT
|
||||
run iptables -A INPUT -s 192.168.238.0/24 -j ACCEPT
|
||||
run iptables -A OUTPUT -d $net.0/24 -j ACCEPT
|
||||
run iptables -A INPUT -s $net.0/24 -j ACCEPT
|
||||
run iptables -A INPUT -s 255.255.255.255 -j ACCEPT
|
||||
run iptables -A INPUT -i "$local_iface" -j ACCEPT
|
||||
|
||||
run iptables -t nat -A POSTROUTING -o "$net_iface" -j MASQUERADE
|
||||
run iptables -A FORWARD -i $net_iface -o $local_iface -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
run iptables -A FORWARD -i $local_iface -o $net_iface -j ACCEPT
|
||||
run dnsmasq --dhcp-range=192.168.238.100,192.168.238.199,10m -d --server=9.9.9.9 --listen-address 192.168.238.254 --interface "$local_iface" -p0
|
||||
run dnsmasq --dhcp-range=$net.100,$net.199,10m -d --server=9.9.9.9 --listen-address $net.254 --interface "$local_iface" -p0
|
||||
|
||||
clean
|
||||
|
@ -3,26 +3,40 @@
|
||||
set -euo pipefail
|
||||
|
||||
echo "vars"
|
||||
htpasswd="$(mktemp)"
|
||||
venv=~/.cache/radicale-venv
|
||||
user="emails"
|
||||
venv="/home/$user/.cache/radicale-venv"
|
||||
htpasswd="$venv/htpasswd"
|
||||
#locale_ip_addr="$(ip -o -4 a show dev usb0 | grep -Po 'inet[[:space:]]+\K192.168.42.[0-9]{1,3}')"
|
||||
locale_ip_addr="192.168.42.58"
|
||||
locale_ip_addr="192.168.42.205"
|
||||
port=5232
|
||||
|
||||
echo ip
|
||||
sudo ip a add "$locale_ip_addr/32" dev usb0 || true
|
||||
|
||||
|
||||
|
||||
sudo -u "$user" bash <<EOF
|
||||
set -euo pipefail
|
||||
|
||||
echo "Creating venv"
|
||||
if [ ! -d "$venv" ] || [ -z "$(ls -A "$venv")" ] ; then
|
||||
virtualvenv "$venv"
|
||||
python -m venv "$venv"
|
||||
. "$venv/bin/activate"
|
||||
pip3 install radicale
|
||||
fi
|
||||
|
||||
sudo ip a add "$locale_ip_addr" dev usb0
|
||||
|
||||
echo "populating htpasswd. Enter password :"
|
||||
htpasswd -c "$htpasswd" dav
|
||||
if [ ! -s "$htpasswd" ] ; then
|
||||
htpasswd -c "$htpasswd" dav
|
||||
fi
|
||||
|
||||
echo "venv"
|
||||
. venv/bin/activate
|
||||
echo "activating venv"
|
||||
. "$venv/bin/activate"
|
||||
|
||||
echo "runing on $locale_ip_addr:$port"
|
||||
python3 -m radicale -H "$locale_ip_addr:$port" --storage-filesystem-folder=~/.contacts --auth-type=htpasswd --auth-htpasswd-encryption md5 --auth-htpasswd-filename "$htpasswd"
|
||||
python3 -m radicale -H "$locale_ip_addr:$port" --storage-filesystem-folder=~/.contacts/bdays --auth-type=htpasswd --auth-htpasswd-encryption md5 --auth-htpasswd-filename "$htpasswd"
|
||||
|
||||
echo "Cleaning"
|
||||
rm "$htpasswd"
|
||||
EOF
|
||||
|
||||
echo "OK. Terminated."
|
||||
|
24
redshift.sh
24
redshift.sh
@ -82,27 +82,26 @@ i=0
|
||||
xrandr --listactivemonitors | tail -n +2 | cut -d ' ' -f 6 | while read monitor ; do
|
||||
args=''
|
||||
if [ "$i" -eq 0 ] ; then
|
||||
brightness="$(brigthness_of_display "$monitor")"
|
||||
read r g b <<< "$(gamma_of_display "$monitor")"
|
||||
((i=i+1))
|
||||
case "$property" in
|
||||
brightness)
|
||||
if [ "$action" = '=' ] ; then
|
||||
args="--brightness 1"
|
||||
brightness=1
|
||||
else
|
||||
b="$(brigthness_of_display "$monitor")"
|
||||
b="$( echo "$b $action $BRIGHTNESS_INCREMENT" | bc -l )"
|
||||
args="--brightness $b"
|
||||
brightness="$( echo "$brightness $action $BRIGHTNESS_INCREMENT" | bc -l )"
|
||||
fi
|
||||
;;
|
||||
redness)
|
||||
if [ "$action" = '=' ] ; then
|
||||
args="--gamma 1:1:1"
|
||||
r=1
|
||||
g=1
|
||||
b=1
|
||||
else
|
||||
read r g b <<< "$(gamma_of_display "$monitor")"
|
||||
|
||||
rnew="$( echo "$r $action $R_INCREMENT" | bc -l )"
|
||||
gnew="$( echo "$g $action $G_INCREMENT" | bc -l )"
|
||||
bnew="$( echo "$b $action $B_INCREMENT" | bc -l )"
|
||||
args="--gamma $rnew:$gnew:$bnew"
|
||||
r="$( echo "$r $action $R_INCREMENT" | bc -l )"
|
||||
g="$( echo "$g $action $G_INCREMENT" | bc -l )"
|
||||
b="$( echo "$b $action $B_INCREMENT" | bc -l )"
|
||||
#echo "from $r:$g:$b to $rnew:$gnew:$bnew"
|
||||
fi
|
||||
;;
|
||||
@ -110,6 +109,9 @@ xrandr --listactivemonitors | tail -n +2 | cut -d ' ' -f 6 | while read monitor
|
||||
echo "Invalid property $property"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
# Build command line args from variables
|
||||
args="--brightness $brightness --gamma $r:$g:$b"
|
||||
else
|
||||
args="--same-as $monitor"
|
||||
fi
|
||||
|
24
startsync
24
startsync
@ -2,7 +2,25 @@
|
||||
|
||||
#feedreader &>/dev/null &
|
||||
#jami-gnome &>/dev/null &
|
||||
nicotine &>/dev/null &
|
||||
qbittorrent &>/dev/null &
|
||||
#nicotine &>/dev/null &
|
||||
#qbittorrent &>/dev/null &
|
||||
#vdirsyncer sync
|
||||
sudo -u emails syncmails
|
||||
|
||||
if [ "$(host -t a wg.rezine.org 9.9.9.9 2>/dev/null | grep -o ' has address .*')" != "$(host -t a wg.rezine.org 2>/dev/null | grep -o ' has address .*')" ] ; then
|
||||
echo "-------------------------"
|
||||
echo ""
|
||||
echo "wg.rezine.org seems to have changed, you mail need to update your /etc/dnsmasq.conf"
|
||||
notify-send "Consistency check" "wg.rezine.org seems to have changed, you mail need to update your /etc/dnsmasq.conf"
|
||||
echo ""
|
||||
echo "-------------------------"
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
|
||||
sudo -u emails bash <<EOF
|
||||
if [ -n "\$(find ~/.mails/collected_addresses.txt -mtime +24)" ] ; then
|
||||
echo 'Rebuild mail addressbook'
|
||||
(notmuch address --output sender '*' ; notmuch address --output recipients '*') | grep -vP "<.*[\x00-\x1F\x7F-\xFF].*>" | grep -vP "[\x00-\x1F\x7F-\xFF]\S*@" | grep -vP "@\S*[\x00-\x1F\x7F-\xFF]" | sort -u > ~/.mails/collected_addresses.txt
|
||||
fi
|
||||
syncmails
|
||||
EOF
|
||||
|
14
syncmails
14
syncmails
@ -1,7 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
offlineimap
|
||||
set -u
|
||||
|
||||
cd ~/offlineimap3
|
||||
if [ ! -d venv ] ; then
|
||||
virtualenv venv
|
||||
fi
|
||||
|
||||
. venv/bin/activate
|
||||
|
||||
python offlineimap.py
|
||||
|
||||
while true ; do
|
||||
sleep 30
|
||||
offlineimap -q
|
||||
python offlineimap.py -q
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user