--- /dev/null
+#!/bin/sh
+
+set -e
+
+MAIN=$(xrandr | grep eDP | cut -f1 -d" ")
+if [ "${MAIN}" = "" ]; then
+ echo "Could not find main display."
+ exit 1
+fi
+
+OTHER=$(xrandr | grep "\<connected\>" | grep -v eDP | cut -f1 -d" ")
+if [ "${OTHER}" = "" ]; then
+ echo "Could not find external display."
+ exit 1
+fi
+
+echo "Set ${MAIN} as mirror of ${OTHER}"
+
+xrandr --output ${OTHER} --auto --output ${MAIN} --same-as ${OTHER} --primary
--- /dev/null
+#!/bin/sh
+
+set -e
+
+MAIN=$(xrandr | grep eDP | cut -f1 -d" ")
+if [ "${MAIN}" = "" ]; then
+ echo "Could not find main display."
+ exit 1
+fi
+
+OTHER=$(xrandr | grep "\<connected\>" | grep -v eDP | cut -f1 -d" ")
+if [ "${OTHER}" = "" ]; then
+ echo "Could not find external display."
+ exit 1
+fi
+
+echo "Bring ${OTHER} right of ${MAIN}"
+
+xrandr --output ${MAIN} --auto --primary; xrandr --output ${OTHER} --auto; xrandr --output ${OTHER} --auto --right-of ${MAIN}
--- /dev/null
+#!/bin/sh
+
+set -e
+
+MAIN=$(xrandr | grep eDP | cut -f1 -d" ")
+if [ "${MAIN}" = "" ]; then
+ echo "Could not find main display."
+ exit 1
+fi
+
+echo "Set ${MAIN} as primary"
+xrandr --output ${MAIN} --auto --primary
+
+OTHER=$(xrandr | grep "\<connected\>" | grep -v eDP | cut -f1 -d" ")
+if [ "${OTHER}" = "" ]; then
+ echo "Could not find external display."
+ exit 1
+fi
+
+echo "Set ${OTHER} off"
+xrandr --output ${OTHER} --off
#!/usr/bin/env python3
"""Creates a webpage with all entries of a .bib file"""
-__version__ = "1.0"
+__version__ = "1.1"
__author__ = "Stefan Huber"
__email__ = "shuber@sthu.org"
# OTHER DEALINGS IN THE SOFTWARE.
-import os, sys, getopt
+import os, sys, getopt, re
+import dateutil.parser
def format_latex(text):
- return text.replace('{', '').replace('}', '').replace('\\', '')
+ # Get rid of matching dollar signs
+ text = re.sub(r'\$([^\$]*)\$', r'\1', text)
+
+ # Replace text
+ subst = {
+ '\\"a': 'ä',
+ '\\"o': 'ö',
+ '\\"u': 'u',
+ '\mathcal': '',
+ '{': '',
+ '}': '',
+ '\\': '',
+ '~': ' ',
+ '---': '–',
+ '--': '–',
+ }
+
+ for a, b in subst.items():
+ text = text.replace(a, b)
+
+ return text
def format_field_span(type, value):
return "<span class=bibentry_" + type + ">" + format_latex(value) + "</span>"
format_field(entry, 'number', pre='(', post=')'))
line.append(format_field(entry, 'month', post=' ') + \
format_field(entry, 'year'))
- line = filter(lambda l: l != "", line)
+ line.append(format_field(entry, 'note'))
+ line = filter(lambda l: l != "", line)
return [where, ", ".join(line)]
def format_details_inproceedings(entry):
line.append(format_field(entry, 'address'))
line.append(format_field(entry, 'month', post=' ') + \
format_field(entry, 'year'))
+ line.append(format_field(entry, 'isbn', pre='ISBN '))
+ line.append(format_field(entry, 'note'))
+
+ line = filter(lambda l: l != "", line)
+ return [where, ", ".join(line)]
+
+def format_details_incollection(entry):
+ where = format_field(entry, 'booktitle')
+
+ line = []
+ line.append(format_field(entry, 'publisher'))
+ line.append(format_field(entry, 'pages', pre='pp. '))
+ line.append(format_field(entry, 'address'))
+ line.append(format_field(entry, 'month', post=' ') + \
+ format_field(entry, 'year'))
+ line.append(format_field(entry, 'isbn', pre='ISBN '))
+ line.append(format_field(entry, 'note'))
+
line = filter(lambda l: l != "", line)
return [where, ", ".join(line)]
line.append(format_field(entry, 'school'))
line.append(format_field(entry, 'month', post=' ') + \
format_field(entry, 'year'))
+ line.append(format_field(entry, 'note'))
+
line = filter(lambda l: l != "", line)
return [", ".join(line)]
line.append(format_field(entry, 'isbn', pre='ISBN '))
line.append(format_field(entry, 'month', post=' ') + \
format_field(entry, 'year'))
+ line.append(format_field(entry, 'note'))
+
+ line = filter(lambda l: l != "", line)
+ return [", ".join(line)]
+
+def format_details_patent(entry):
+ line = []
+ line.append(format_field(entry, 'number', pre='Pat. '))
+ line.append(format_field(entry, 'month', post=' ') + \
+ format_field(entry, 'year'))
+ line.append(format_field(entry, 'note'))
+
line = filter(lambda l: l != "", line)
return [", ".join(line)]
doi = format_field(entry, 'doi', pre='<a href="http://dx.doi.org/', post='">[DOI]</a>')
webpdf = format_field(entry, 'webpdf', pre='<a href="', post='">[PDF]</a>')
weblink = format_field(entry, 'weblink', pre='<a href="', post='">[link]</a>')
+ url = format_field(entry, 'url', pre='<a href="', post='">[url]</a>')
webslides = format_field(entry, 'webslides', pre='<a href="', post='">[slides]</a>')
weberrata = format_field(entry, 'weberrata', pre='<a href="',
post='">[errata]</a>')
- return " ".join([doi, webpdf, weblink, webslides, weberrata])
+ return " ".join([doi, webpdf, weblink, url, webslides, weberrata])
def format_entry(entry):
lines = []
lines.extend(format_details_article(entry))
elif entry.type=='inproceedings':
lines.extend(format_details_inproceedings(entry))
+ elif entry.type=='incollection':
+ lines.extend(format_details_incollection(entry))
elif entry.type=='book':
lines.extend(format_details_book(entry))
+ elif entry.type=='patent':
+ lines.extend(format_details_patent(entry))
elif entry.type in ['mastersthesis', 'phdthesis']:
lines.extend(format_details_thesis(entry))
else:
def entryDateSortKey(p):
k, e = p
+ if 'date' in e.fields:
+ return e.fields['date']
+
month2num = { 'jan' : '01', 'feb' : '02', 'mar' : '03', \
'apr' : '04', 'may' : '05', 'jun' : '06', \
'jul' : '07', 'aug' : '08', 'sep' : '09', \
'oct' : '10', 'nov' : '11', 'dec' : '12'}
+
+ if not 'month' in e.fields:
+ return e.fields['year']
+
month = e.fields['month'].lower()[0:3]
if month in month2num:
month = month2num[month]
else:
month = ""
+
return e.fields['year'] + "-" + month
+def entryGetYear(e):
+ if 'year' in e.fields:
+ return e.fields['year']
+
+ if 'date' in e.fields:
+ dt = dateutil.parser.isoparse(e.fields['date'])
+ return str(dt.year)
+
+ return None
+
+
def usage():
"""Print usage text of this program"""
bib_data = parser.parse_file(bibfile)
entries = bib_data.entries
- years = list(set([ b.fields['year'] for b in entries.values() ]))
+ years = list(set([entryGetYear(e) for e in entries.values()]))
years.sort(reverse=True)
for year in years:
iteritems.sort(key=entryDateSortKey, reverse=True)
for key, entry in iteritems:
- if entry.fields['year'] != year:
+ if entryGetYear(entry) != year:
continue
print("<div class=bibentry>")
- print("<a class=bibentry_key id=" + key + ">[" + key + "]</a><br/>")
-
+ print("<a class=bibentry_key id={}>[{}]</a><br/><span class=bibentry_type>{}</span><br/>".format(key, key, entry.type))
e = format_entry(entry)
print(e)
print("</div>\n")
-
--- /dev/null
+#!/bin/dash
+#
+# Stefan Huber <shuber2@gmail.com>
+# Display battery info for conky
+
+
+
+if [ -e /sys/devices/platform/smapi/ ]
+then
+ for b in `find /sys/devices/platform/smapi/ -type d -name BAT?`
+ do
+ if [ `cat $b/installed` = "1" ]
+ then
+ name=${b##*/}
+ remcap=`cat $b/remaining_capacity`
+ remcapper=`cat $b/remaining_percent`
+ ratenow=`cat $b/power_now`
+ rateavg=`cat $b/power_avg`
+ remtime=`cat $b/remaining_running_time`
+ tempmilli=`cat $b/temperature`
+ temp=`echo "$tempmilli/1000" | bc`
+
+ if [ "$remtime" = "not_discharging" ]; then
+ remtime=`cat $b/remaining_charging_time`
+ fi
+ if [ "$remtime" = "not_charging" ]; then
+ remtime="--"
+ fi
+
+ echo "$name rate: $ratenow mW [~ $rateavg mW]"
+ echo "rem: $remcap mWh [$remcapper%, $remtime min]"
+ #echo "$name temp: $temp°C"
+ fi
+ done
+else
+ for b in `find /proc/acpi/battery/ -type d -name BAT?`
+ do
+ if [ `grep -c -E "^present: *yes" $b/state` = "1" ]
+ then
+ name=${b##*/}
+ fullcap=`grep "last full capacity" $b/info | awk ' { print $4 } '`
+ remcap=`grep "remaining capacity" $b/state | awk ' { print $3 } '`
+ rate=`grep "present rate" $b/state | awk ' { print $3 } '`
+
+ if [ $rate = "0" ]; then
+ remtime="--"
+ else
+ remtime=`echo "$remcap*60/$rate" | bc`
+ fi
+
+ remcapper=`echo "$remcap*100/$fullcap" | bc `
+
+ echo "$name rate: $rate mW"
+ echo "$name rem.: $remcap mWh [$remcapper%, $remtime min]"
+ fi
+ done
+fi
+
+
-alignment top_left
-gap_x 0
-gap_y 35
-maximum_width 200
-#minimum_size 200
-
-update_interval 2
-cpu_avg_samples 2
-net_avg_samples 2
-
-# for the green bg
-#default_color 563
-#color0 221
-#color1 894
-# for the blue bg
-default_color bbb
-color0 fff
-color1 b94
-draw_shades no
-use_spacer left
-top_name_width 13
-default_bar_size 85 5
-
-if_up_strictness address
-short_units yes
-no_buffers yes
-
-double_buffer yes
-own_window yes
-own_window_transparent yes
-own_window_type normal
-own_window_hints sticky, below, undecorated, skip_taskbar, skip_pager
-own_window_colour 082140
-
-use_xft yes
-xftfont DejaVu Sans Mono:size=7.5
-#xftalpha 0.8
-
-
-
-# Usr ${execi 6 who | cut -d " " -f 1 - | sort -u | wc -l}
-
-
-TEXT
-${color0}${font Arial:size=12}Gentoo Linux$font $alignr${kernel}$color
-$alignr$acpitemp°C
-$color${font DejaVu Sans Mono:bold:size=8}${cpu cpu1}% ${cpu cpu2}% ${cpu cpu3}% ${cpu cpu4}%$alignr$mem ($memperc%)$font
-${cpugraph cpu1 20,32} ${cpugraph cpu2 20,32} ${cpugraph cpu3 20,32} ${cpugraph cpu4 20,32} $alignr${color1}${memgraph 20,32}$color
-
-${color0}${font DejaVu Sans:size=10}eth0: $font${if_up eth0}${addr eth0}$endif ${execi 2 ~/.conky/eth0info.sh} ${hr 3}$color ${if_up eth0}
+-- vim: ts=4 sw=4 noet ai cindent syntax=lua
+
+conky.config = {
+ alignment = 'top_left',
+ gap_x = 10,
+ gap_y = 50,
+ maximum_width = 340,
+
+ update_interval = 2,
+ cpu_avg_samples = 2,
+ net_avg_samples = 2,
+
+ default_color = '444',
+ color0 = '000',
+ color1 = '222',
+
+ draw_shades = false,
+ use_spacer = 'left',
+ top_name_width = 13,
+
+ if_up_strictness = 'address',
+ short_units = true,
+ no_buffers = true,
+
+ double_buffer = true,
+ own_window = true,
+ own_window_class = 'Conky',
+ own_window_type = 'dock',
+ own_window_hints = 'below,undecorated,below,skip_taskbar,sticky,skip_pager',
+ own_window_transparent = true,
+
+ use_xft = true,
+ font = 'Hack:size=8.5',
+};
+
+conky.text = [[
+${color0}${font Arial:size=14}Gentoo Linux$font $alignr${kernel}$color
+$time$alignr$acpitemp°C
+$color${cpu cpu1}% ${cpu cpu2}% ${cpu cpu3}% ${cpu cpu4}%$alignr$mem ($memperc%)$font
+${cpugraph cpu1 32,40} ${cpugraph cpu2 32,40} ${cpugraph cpu3 32,40} ${cpugraph cpu4 32,40} $alignr${color1}${memgraph 32,40}$color
+
+${color0}${font DejaVu Sans:size=12}eth0: $font${if_up eth0}${addr eth0}$endif ${execi 2 ~/.conky/eth0info.sh} ${hr 3}$color ${if_up eth0}
${downspeed eth0} ${upspeed eth0} $alignr${color1}Sum$color ${totaldown eth0} ${totalup eth0}
-${downspeedgraph eth0 20,90} $alignr${upspeedgraph eth0 20,90} $endif
+${downspeedgraph eth0 32,125} $alignr${upspeedgraph eth0 32,125}$endif
-${if_up wlan0}${color0}${font DejaVu Sans:size=10}wlan0: $font${addr wlan0} ${hr 3}$color
+${if_up wlan0}${color0}${font DejaVu Sans:size=12}wlan0: $font${addr wlan0} ${hr 3}$color
$color${wireless_essid wlan0} $alignr${wireless_link_qual_perc wlan0}% ${wireless_bitrate wlan0}
${downspeed wlan0} ${upspeed wlan0} $alignr${color1}Sum$color ${totaldown wlan0} ${totalup wlan0}
-${downspeedgraph wlan0 20,90} $alignr${upspeedgraph wlan0 20,90}
+${downspeedgraph wlan0 32,125} $alignr${upspeedgraph wlan0 32,125}\
$endif\
-${if_up tun0}${color0}${font DejaVu Sans:size=10}tun0: $font${addr tun0} ${hr 3}$color
+${if_up bnep0}${color0}${font DejaVu Sans:size=12}bnep0: $font${addr bnep0} ${hr 3}$color
+${downspeed bnep0} ${upspeed bnep0} $alignr${color1}Sum$color ${totaldown bnep0} ${totalup bnep0}
+${downspeedgraph bnep0 32,125} $alignr${upspeedgraph bnep0 32,125}
+
+$endif\
+${if_up wg0}${color0}${font DejaVu Sans:size=12}wg0: $font${addr wg0} ${hr 3}$color
+${downspeed wg0} ${upspeed wg0} $alignr${color1}Sum$color ${totaldown wg0} ${totalup wg0}
+${downspeedgraph wg0 32,125} $alignr${upspeedgraph wg0 32,125}\
+
+$endif\
+${if_up tun0}${color0}${font DejaVu Sans:size=12}tun0: $font${addr tun0} ${hr 3}$color
${downspeed tun0} ${upspeed tun0} $alignr${color1}Sum$color ${totaldown tun0} ${totalup tun0}
-${downspeedgraph tun0 20,90} $alignr${upspeedgraph tun0 20,90}\
+${downspeedgraph tun0 32,125} $alignr${upspeedgraph tun0 32,125}\
$endif\
-${if_up dns0}${color0}${font DejaVu Sans:size=10}dns0: $font${addr dns0} ${hr 3}$color
-${downspeed dns0} ${upspeed dns0} $alignr${color1}Sum$color ${totaldown dns0} ${totalup dns0}
-${downspeedgraph dns0 20,90} $alignr${upspeedgraph dns0 20,90}
+${if_up tun1}${color0}${font DejaVu Sans:size=12}tun1: $font${addr tun1} ${hr 3}$color
+${downspeed tun1} ${upspeed tun1} $alignr${color1}Sum$color ${totaldown tun1} ${totalup tun1}
+${downspeedgraph tun1 32,125} $alignr${upspeedgraph tun1 32,125}\
$endif\
-${color0}${font DejaVu Sans:size=10}FS & Disc ${hr 3}$font$color
-${color1}ssd $color${fs_used /} / ${fs_size /} $alignr${fs_bar /}
-${if_mounted /media/storage}${color1}hdd $color${execi 60 ~/.conky/hddinfo.sh} $alignr${execibar 60 ~/.conky/hddbar.sh}
+${if_up dns0}${color0}${font DejaVu Sans:size=12}dns0: $font${addr dns0} ${hr 3}$color
+${downspeed dns0} ${upspeed dns0} $alignr${color1}Sum$color ${totaldown dns0} ${totalup dns0}
+${downspeedgraph dns0 32,125} $alignr${upspeedgraph dns0 32,125}
+
$endif\
-${color1}all $color${diskio_read} ${diskio_write} $alignr${color1}sdb $color${diskio_read sdb} ${diskio_write sdb}
-${diskiograph_read 20,42} ${diskiograph_write 20,42} $alignr${diskiograph_read sdb 20,42} ${diskiograph_write sdb 20,42}
+${color0}${font DejaVu Sans:size=12}FS & Disc ${hr 3}$font$color
+${color1}ssd $color${fs_used /} / ${fs_size /} $alignr${fs_bar 10,100 /}
${execi 5 ~/.conky/showmounts.sh}\
-${color0}${font DejaVu Sans:size=10}Top$font [$uptime_short, $processes] ${hr 3}$color
-${top name 1} ${top pid 1}${top cpu 1} ${top mem_res 1}
-${top name 2} ${top pid 2}${top cpu 2} ${top mem_res 2}
-${top name 3} ${top pid 3}${top cpu 3} ${top mem_res 3}
-${top name 4} ${top pid 4}${top cpu 4} ${top mem_res 4}
-${color1}By Mem$color
-${top_mem name 1} ${top_mem pid 1}${top_mem cpu 1} ${top_mem mem_res 1}
-${top_mem name 2} ${top_mem pid 2}${top_mem cpu 2} ${top_mem mem_res 2}
-${top_mem name 3} ${top_mem pid 3}${top_mem cpu 3} ${top_mem mem_res 3}
-${color1}By IO rd wr$color
-${top_io name 1} ${top_io pid 1} ${top_io io_read 1} ${top_io io_write 1}
-${top_io name 2} ${top_io pid 2} ${top_io io_read 2} ${top_io io_write 2}
-${top_io name 3} ${top_io pid 3} ${top_io io_read 3} ${top_io io_write 3}
-
-${color0}${font DejaVu Sans:size=10}Battery ${hr 3}$font$color
-$color${smapi bat 0 remaining_capacity} mWh (${smapi_bat_perc 0}%) $alignr${smapi_bat_bar 0}
- ${smapi bat 0 power_now} mW [${smapi bat 0 power_avg}, ${smapi bat 0 remaining_running_time} min]
-#${color1}${execi 6 ~/.conky/tempinfo.sh}$color
+${color1}all $color${diskio_read} ${diskio_write} $alignr${color1}sda $color${diskio_read sda} ${diskio_write sda}
+${diskiograph_read 32,55} ${diskiograph_write 32,55} $alignr${diskiograph_read sda 32,55} ${diskiograph_write sda 32,55}
+
+${color0}${font DejaVu Sans:size=12}Top$font [$uptime_short, $processes] ${hr 3}$color
+ ${top name 1} ${top pid 1}${top cpu 1} ${top mem_res 1}
+ ${top name 2} ${top pid 2}${top cpu 2} ${top mem_res 2}
+ ${top name 3} ${top pid 3}${top cpu 3} ${top mem_res 3}
+ ${top name 4} ${top pid 4}${top cpu 4} ${top mem_res 4}
+${color1}Mem:$color
+ ${top_mem name 1} ${top_mem pid 1}${top_mem cpu 1} ${top_mem mem_res 1}
+ ${top_mem name 2} ${top_mem pid 2}${top_mem cpu 2} ${top_mem mem_res 2}
+ ${top_mem name 3} ${top_mem pid 3}${top_mem cpu 3} ${top_mem mem_res 3}
+${color1}IO: rd wr$color
+ ${top_io name 1} ${top_io pid 1} ${top_io io_read 1} ${top_io io_write 1}
+ ${top_io name 2} ${top_io pid 2} ${top_io io_read 2} ${top_io io_write 2}
+ ${top_io name 3} ${top_io pid 3} ${top_io io_read 3} ${top_io io_write 3}
+
+${execi 10 ~/.conky/showmails.sh}
+${color0}${font DejaVu Sans:size=12}Battery ${hr 3}$font$color
+${execi 3 upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep energy-rate: | awk '{ printf "%4.1f %s", $2, $3}'} | ${execi 600 upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep energy-full: | sed 's/^.*: *\(.*\)$/\1/g'}$alignr${battery_percent BAT0}% ${battery_bar 10,100 BAT0}
+${execi 3 upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep energy-rate: | awk '{ printf "%4.1f %s", $2, $3}'} | ${execi 600 upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep energy-full: | sed 's/^.*: *\(.*\)$/\1/g'}$alignr${battery_percent BAT1}% ${battery_bar 10,100 BAT1}
+${execi 5 upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep 'time to empty:' | awk '{ print $4 " " $5}'}${execi 5 upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep 'time to full:' | awk '{ print $4 " " $5}'}$alignr${execi 5 upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep percentage: | awk '{ printf "%4.1f", $2}'}% ${execibar 10 10,100 upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep percentage: | awk '{ print $2}'}
+]];
--- /dev/null
+-- vim: ts=4 sw=4 noet ai cindent syntax=lua
+
+conky.config = {
+ alignment = 'bottom_left',
+ gap_y = 0,
+ maximum_width = 1600,
+
+ update_interval = 2,
+ cpu_avg_samples = 2,
+ net_avg_samples = 2,
+
+ default_color = '444',
+ color0 = '000',
+ color1 = '222',
+
+ draw_shades = false,
+ use_spacer = 'left',
+ top_name_width = 13,
+
+ if_up_strictness = 'address',
+ short_units = true,
+ no_buffers = true,
+
+ double_buffer = true,
+ own_window = true,
+ own_window_class = 'Conky',
+ own_window_type = 'dock',
+ own_window_hints = 'below,undecorated,below,skip_taskbar,sticky,skip_pager',
+ own_window_transparent = true,
+
+ use_xft = true,
+ font = 'Hack:size=8.5',
+};
+
+conky.text = [[
+${color1}${execi 2 tail -n 14 /tmp/messages}$color
+]]
--- /dev/null
+#!/bin/bash
+
+if ip link show dev eth0 | grep -q UP ; then
+ operstate=$(cat /sys/class/net/eth0/operstate | tr -d '\n')
+ echo -n "["
+ if [ "${operstate}" = "up" ]; then
+ #duplex=$(cat /sys/class/net/eth0/duplex | tr -d '\n')
+ speed=$(cat /sys/class/net/eth0/speed | tr -d '\n')
+ echo -n "${speed} Mbit"
+ else
+ echo -n "${operstate}"
+ fi
+ echo -n "]"
+else
+ echo -n "[power down]"
+fi
--- /dev/null
+#!/bin/sh
+
+df -h | grep /media/storage | awk ' { print $5 } '
--- /dev/null
+#!/bin/sh
+
+df -h | grep -m 1 /media/storage | awk ' { print $3 " / " $2 } '
--- /dev/null
+-- vim: ts=4 sw=4 noet ai cindent syntax=lua
+
+conky.config = {
+ alignment = 'bottom_left',
+ gap_y = 0,
+ maximum_width = 1600,
+
+ update_interval = 2,
+ cpu_avg_samples = 2,
+ net_avg_samples = 2,
+
+ default_color = '444',
+ color0 = '000',
+ color1 = '222',
+
+ draw_shades = false,
+ use_spacer = 'left',
+ top_name_width = 13,
+
+ if_up_strictness = 'address',
+ short_units = true,
+ no_buffers = true,
+
+ double_buffer = true,
+ own_window = true,
+ own_window_class = 'Conky',
+ own_window_type = 'dock',
+ own_window_hints = 'below,undecorated,below,skip_taskbar,sticky,skip_pager',
+ own_window_transparent = true,
+
+ use_xft = true,
+ font = 'Hack:size=8.5',
+};
+
+conky.text = [[
+${color1}${execi 2 journalctl -n 14 --no-hostname -q}$color
+]]
--- /dev/null
+#!/bin/sh
+
+for f in `find $HOME/.smailq/data -name "*.eml"`; do
+ to=`grep To: $f | tail -c +5 | head -c 15`
+ subj=`grep Subject: $f | tail -c +10`
+ echo "$to: $subj"
+done
#!/bin/sh
-df -h | grep '/dev/s[rd][c-z0-9]' | awk '{ print $1 "\t" $5 " " $6}' | sed "s_/dev/__" | sort
-df -h | grep '/dev/mmc*' | awk '{ print $1 "\t" $5 " " $6}' | sed "s_/dev/__" | sort
+
+for path in '/dev/s[rd][b-z0-9]' '/dev/mmc' '/dev/mapper/_' '//192' '/media/nas' '/media/fhs' '$HOME/.mount'; do
+ df -h 2>/dev/null | grep "$path" | awk '{ printf "%-25.25s %4s %4s\n", substr($6, length($6)-24), $4, $5 }'
+done
--- /dev/null
+-- vim: ts=4 sw=4 noet ai cindent syntax=lua
+
+conky.config = {
+ alignment = 'top_left',
+ gap_x = 10,
+ gap_y = 50,
+ maximum_width = 340,
+
+ update_interval = 2,
+ cpu_avg_samples = 2,
+ net_avg_samples = 2,
+
+ default_color = 'c0c0c0',
+ color0 = 'b21818',
+ color1 = 'ffffff',
+
+ draw_shades = false,
+ use_spacer = 'left',
+ top_name_width = 13,
+
+ if_up_strictness = 'address',
+ short_units = true,
+ no_buffers = true,
+
+ double_buffer = true,
+ own_window = true,
+ --own_window_colour = 'f8ecc7',
+ own_window_class = 'Conky',
+ own_window_type = 'desktop',
+ own_window_hints = 'below,undecorated,below,skip_taskbar,sticky,skip_pager',
+ --own_window_transparent = true,
+ own_window_argb_visual = true,
+ own_window_argb_value = 30,
+
+ use_xft = true,
+ font = 'Hack:size=8.5',
+};
+
+conky.text = [[
+${color0}${font Arial:size=14}Gentoo Linux$font $alignr${kernel}$color
+$time$alignr$acpitemp°C
+$color${cpu cpu1}% ${cpu cpu2}% ${cpu cpu3}% ${cpu cpu4}%$alignr$mem ($memperc%)$font
+${cpugraph cpu1 32,40} ${cpugraph cpu2 32,40} ${cpugraph cpu3 32,40} ${cpugraph cpu4 32,40} $alignr${color1}${memgraph 32,40}$color
+
+${color0}${font DejaVu Sans:size=12}eth0: $font${if_up eth0}${addr eth0}$endif ${execi 2 ~/.conky/eth0info.sh} ${hr 3}$color ${if_up eth0}
+${downspeed eth0} ${upspeed eth0} $alignr${color1}Sum$color ${totaldown eth0} ${totalup eth0}
+${downspeedgraph eth0 32,125} $alignr${upspeedgraph eth0 32,125}$endif
+
+${if_up wlan0}${color0}${font DejaVu Sans:size=12}wlan0: $font${addr wlan0} ${hr 3}$color
+$color${wireless_essid wlan0} $alignr${wireless_link_qual_perc wlan0}% ${wireless_bitrate wlan0}
+${downspeed wlan0} ${upspeed wlan0} $alignr${color1}Sum$color ${totaldown wlan0} ${totalup wlan0}
+${downspeedgraph wlan0 32,125} $alignr${upspeedgraph wlan0 32,125}\
+
+$endif\
+${if_up bnep0}${color0}${font DejaVu Sans:size=12}bnep0: $font${addr bnep0} ${hr 3}$color
+${downspeed bnep0} ${upspeed bnep0} $alignr${color1}Sum$color ${totaldown bnep0} ${totalup bnep0}
+${downspeedgraph bnep0 32,125} $alignr${upspeedgraph bnep0 32,125}
+
+$endif\
+${if_up wg0}${color0}${font DejaVu Sans:size=12}wg0: $font${addr wg0} ${hr 3}$color
+${downspeed wg0} ${upspeed wg0} $alignr${color1}Sum$color ${totaldown wg0} ${totalup wg0}
+${downspeedgraph wg0 32,125} $alignr${upspeedgraph wg0 32,125}\
+
+$endif\
+${if_up tun0}${color0}${font DejaVu Sans:size=12}tun0: $font${addr tun0} ${hr 3}$color
+${downspeed tun0} ${upspeed tun0} $alignr${color1}Sum$color ${totaldown tun0} ${totalup tun0}
+${downspeedgraph tun0 32,125} $alignr${upspeedgraph tun0 32,125}\
+
+$endif\
+${if_up tun1}${color0}${font DejaVu Sans:size=12}tun1: $font${addr tun1} ${hr 3}$color
+${downspeed tun1} ${upspeed tun1} $alignr${color1}Sum$color ${totaldown tun1} ${totalup tun1}
+${downspeedgraph tun1 32,125} $alignr${upspeedgraph tun1 32,125}\
+
+$endif\
+${if_up dns0}${color0}${font DejaVu Sans:size=12}dns0: $font${addr dns0} ${hr 3}$color
+${downspeed dns0} ${upspeed dns0} $alignr${color1}Sum$color ${totaldown dns0} ${totalup dns0}
+${downspeedgraph dns0 32,125} $alignr${upspeedgraph dns0 32,125}
+
+$endif\
+${color0}${font DejaVu Sans:size=12}FS & Disc ${hr 3}$font$color
+${color1}ssd $color${fs_used /} / ${fs_size /} $alignr${fs_bar 10,100 /}
+${execi 5 ~/.conky/showmounts.sh}\
+
+${color1}all $color${diskio_read} ${diskio_write} $alignr${color1}sda $color${diskio_read sda} ${diskio_write sda}
+${diskiograph_read 32,55} ${diskiograph_write 32,55} $alignr${diskiograph_read sda 32,55} ${diskiograph_write sda 32,55}
+
+${color0}${font DejaVu Sans:size=12}Top$font [$uptime_short, $processes] ${hr 3}$color
+ ${top name 1} ${top pid 1}${top cpu 1} ${top mem_res 1}
+ ${top name 2} ${top pid 2}${top cpu 2} ${top mem_res 2}
+ ${top name 3} ${top pid 3}${top cpu 3} ${top mem_res 3}
+ ${top name 4} ${top pid 4}${top cpu 4} ${top mem_res 4}
+${color1}Mem:$color
+ ${top_mem name 1} ${top_mem pid 1}${top_mem cpu 1} ${top_mem mem_res 1}
+ ${top_mem name 2} ${top_mem pid 2}${top_mem cpu 2} ${top_mem mem_res 2}
+ ${top_mem name 3} ${top_mem pid 3}${top_mem cpu 3} ${top_mem mem_res 3}
+${color1}IO: rd wr$color
+ ${top_io name 1} ${top_io pid 1} ${top_io io_read 1} ${top_io io_write 1}
+ ${top_io name 2} ${top_io pid 2} ${top_io io_read 2} ${top_io io_write 2}
+ ${top_io name 3} ${top_io pid 3} ${top_io io_read 3} ${top_io io_write 3}
+
+${execi 10 ~/.conky/showmails.sh}
+${color0}${font DejaVu Sans:size=12}Battery ${hr 3}$font$color
+${execi 3 upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep energy-rate: | awk '{ printf "%4.1f %s", $2, $3}'} | ${execi 600 upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep energy-full: | sed 's/^.*: *\(.*\)$/\1/g'}$alignr${battery_percent BAT0}% ${battery_bar 10,100 BAT0}
+${execi 3 upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep energy-rate: | awk '{ printf "%4.1f %s", $2, $3}'} | ${execi 600 upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep energy-full: | sed 's/^.*: *\(.*\)$/\1/g'}$alignr${battery_percent BAT1}% ${battery_bar 10,100 BAT1}
+${execi 5 upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep 'time to empty:' | awk '{ print $4 " " $5}'}${execi 5 upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep 'time to full:' | awk '{ print $4 " " $5}'}$alignr${execi 5 upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep percentage: | awk '{ printf "%4.1f", $2}'}% ${execibar 10 10,100 upower -i /org/freedesktop/UPower/devices/DisplayDevice | grep percentage: | awk '{ print $2}'}
+]];
--- /dev/null
+#!/bin/dash
+#
+# Stefan Huber <shuber2@gmail.com>
+# Displays some temperature info
+
+
+if [ -f /proc/acpi/ibm/thermal ]
+then
+ info=`cat /proc/acpi/ibm/thermal | sed "s/^.*://" `
+
+ #1 ??, THM0, strongly reacts on heat at the cooling gills. reacts on cpu
+ #2 DVD: reacts on heat at the dvd drive
+ #3 express card: 31°C REACTS ON HEAT ON PC-CARD SLOT
+ #4 agp, gets active when switched to discrete graphics, reacts on load
+ #5 disappears when bat0 is plugged off --> ~50°C always
+ #6 thinkwiki thinks this is for bat1
+ #7 disappears when bat0 is plugged off --> ~val of bat temp through smapi
+ #8 thinkwiki thinks this is for bat1
+ #9 hdd: 33°C REACTS ON HEAD AT THE HARD DISC AREA
+ #10 igp, reacts on gtkperf
+ #11 heatsink? slowly reacts on heat at cooling gill. slowly reacts on cpu
+
+ cpusocket=`echo $info | awk ' { print $1 } '`
+ dvd=`echo $info | awk ' { print $2 } '`
+ excard=`echo $info | awk ' { print $3 } '`
+ atigpu=`echo $info | awk ' { print $4 } '`
+ hdd=`echo $info | awk ' { print $9 } '`
+ intelgpu=`echo $info | awk ' { print $10 } '`
+ heatsink=`echo $info | awk ' { print $11 } '`
+
+ #No equivalent in $info!! Reacts more directly to load than thm0. Due
+ #to acpi info, this is cpu.
+ cpu=`cat /sys/devices/virtual/thermal/thermal_zone1/temp | awk ' { print $1/1000 } '`
+
+ echo -n "cpu:$cpu°C cpus:$cpusocket°C"
+
+ if [ $intelgpu != "-1" ]; then
+ echo -n " igp:$intelgpu°C"
+ fi
+
+ if [ $atigpu != "-1" ]; then
+ echo -n " agp:$atigpu°C"
+ fi
+
+ echo ""
+ echo "hs:$heatsink°C ec:$excard°C hdd:$hdd°C dvd:$dvd°C"
+else
+ cpu=`cat /sys/devices/virtual/thermal/thermal_zone0/temp | awk ' { print $1/1000 } '`
+ echo "cpu: $cpu°C"
+fi
+
+
+
+
--- /dev/null
+-- vim: ts=4 sw=4 noet ai cindent syntax=lua
+
+conky.config = {
+ alignment = 'top_right',
+ gap_x = 5,
+ gap_y = 50,
+ maximum_width = 600,
+
+ update_interval = 2,
+ cpu_avg_samples = 2,
+ net_avg_samples = 2,
+
+ default_color = '444',
+ color0 = '000',
+ color1 = '222',
+
+ draw_shades = false,
+ use_spacer = 'left',
+ top_name_width = 13,
+
+ if_up_strictness = 'address',
+ short_units = true,
+ no_buffers = true,
+
+ double_buffer = true,
+ own_window = true,
+ own_window_colour = 'f8ecc7',
+ own_window_class = 'Conky',
+ own_window_type = 'dock',
+ own_window_hints = 'below,undecorated,below,skip_taskbar,sticky,skip_pager',
+ own_window_transparent = false,
+
+ use_xft = true,
+ font = 'Hack:size=10',
+};
+
+conky.text = [[
+${color0}${font Arial:size=14}Private$font$color ${hr 3}
+${color1}${execi 5 cat ~/.vimwiki/todos.wiki}$color
+
+${color0}${font Arial:size=14}FHS$font$color ${hr 3}
+${color1}${execi 5 cat ~/.vimwiki/FHS/todos.wiki}$color
+]]
name = Stefan Huber
email = me@example.com
signingkey = 0123456
+# [sendemail]
+# smtpencryption = tls
+# smtpserver = xxx
+# smtpuser = xxx
+# smtppass = xxx
+# smtpsslcertpath = /etc/ssl/certs/ca-certificates.crt
+# from = xxx
+# bcc = xxx
+# suppresscc = author
+# suppresscc = self
+# chainreplyto = true
[http]
#prxy = http://username:password@192.168.9.10:8080
[color]
wdiff = diff -w --word-diff-regex="[^[:space:]]"
wlog = log -w --word-diff-regex="[^[:space:]]"
wshow = show -w --word-diff-regex="[^[:space:]]"
+ fhsprofile = config user.email "xxx@fh-salzburg.ac.at"
[log]
decorate
[diff]
trustExitCode = true
[mergetool "nvimdiff"]
cmd = "nvim -d \"$LOCAL\" \"$REMOTE\" \"$MERGED\" -c 'wincmd w' -c 'wincmd J'"
+[alias]
+ lab = "!lab"
+ lab-i = "!lab issue"
+ li = "!lab issue"
--- /dev/null
+#!/bin/sh
+
+# A script to recursively pull git repositories behind origin.
+
+# Copyright (c) 2022 Stefan Huber
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+set -e
+set -u
+
+showHelp()
+{
+ echo "Recursively pull git repositories behind origin."
+ echo ""
+ echo "Usage:"
+ echo " git-pull-all [OPTIONS]"
+ echo " git-pull-all [OPTIONS] DIR"
+ echo ""
+ echo "OPTIONS:"
+ echo " -a, --ask ask user for each repo before pull"
+ echo " -h, --help show this message"
+ echo " -n, --dry-run do not actually perform pull"
+ echo ""
+ echo ""
+ echo "Examples:"
+ echo ""
+ echo "Recursively find git repositories and invoke pull if"
+ echo "branch is behind origin:"
+ echo ""
+ echo " git-pull-all"
+ echo ""
+ echo "Find git repositories in home directory and print"
+ echo "whether they are up to date:"
+ echo ""
+ echo " git-pull-all -n ~"
+
+}
+
+if ! options=$(getopt -u -o ahn -l ask,help,dry-run -- "$@"); then
+ showHelp >&2
+ exit 1
+fi
+set -- $options
+
+optDryRun=0
+optAsk=0
+
+#Parse the arguments
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h|--help) showHelp; exit 0 ;;
+ -n|--dry-run) optDryRun=1 ;;
+ -a|--ask) optAsk=1 ;;
+ --) shift; break ;;
+ -*) echo "Unrecognized option $1" >&2; showHelp >&2; exit 1 ;;
+ *) break ;;
+ esac
+ shift
+done
+
+for REPODIR in $(find "$@" -name .git -type d 2> /dev/null); do
+
+ REPO=$(dirname ${REPODIR})
+ echo "Run ${REPO} …"
+
+ if [ "${optAsk}" = 1 ]; then
+ read -p " Process [y/N]? " -n1 response
+ echo ""
+
+ [ "${response}" = "y" ] || continue
+ fi
+
+ git -C ${REPO} remote update
+
+ if [ -z "$(git -C ${REPO} status -uno | grep 'Your branch is behind')" ] ; then
+ /usr/bin/echo -e "\e[1;32m Already up to date\e[0m"
+ else
+ if [ "${optDryRun}" = 1 ]; then
+ /usr/bin/echo -e "\e[1;31m Skipping due to dry-run\e[0m"
+ continue
+ fi
+ git -C ${REPO} pull
+ fi
+
+done
if [ $PORT80 = 0 ]; then
cd /var/www/challenges
nohup python3 -m http.server 80 > /dev/null 2>&1 &
- /usr/sbin/iptables -A INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
- /usr/sbin/ip6tables -A INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
+ #/usr/sbin/iptables -A INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
+ #/usr/sbin/ip6tables -A INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
fi
# Stop temp web server and close port 80 if needed.
if [ $PORT80 = 0 ]; then
- /usr/sbin/iptables -D INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
- /usr/sbin/ip6tables -D INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
+ #/usr/sbin/iptables -D INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
+ #/usr/sbin/ip6tables -D INPUT -p tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
pkill -f http.server
fi
--- /dev/null
+#!/usr/bin/env python3
+#
+# FLASK_APP=restpublish.py flask run
+
+import datetime
+
+import flask
+from flask_restful import Resource, Api
+
+
+class Element:
+ def __init__(self, key, value):
+ self.key = key
+ self.update(value)
+
+ def update(self, value):
+ self.value = value
+ self.ctime = datetime.datetime.now()
+
+ def is_expired(self, maxage):
+ return datetime.datetime.now() - self.ctime >= maxage
+
+
+class ElementStore:
+ def __init__(self):
+ self.key_dict = dict()
+ self.chronolist = list()
+
+ def insert(self, key, value):
+ if key in self.key_dict:
+ el = self.key_dict[key]
+ el.update(value)
+ else:
+ el = Element(key, value)
+ self.key_dict[key] = el
+ self.chronolist.append(el)
+ return el
+
+ def remove(self, key):
+ del self.key_dict[key]
+ self.chronolist = [el for el in self.chronolist if el.key != key]
+
+ def garbagecollect(self):
+ maxage = datetime.timedelta(7)
+ oldestctime = datetime.datetime.now() - maxage
+ def is_expired(el):
+ return el.ctime < oldestctime
+
+ # Get idx such that self.chronolist[:idx] is expired and
+ # self.chronolist[idx:] is not expired.
+ idx = 0
+ while idx < len(self.chronolist) - 1:
+ if not is_expired(self.chronolist[idx]):
+ break
+ idx += 1
+
+ for el in self.chronolist[:idx]:
+ del self.key_dict[el.key]
+
+ self.chronolist = self.chronolist[idx:]
+
+
+class EntryPoint(Resource):
+ def get(self):
+ return { 'elements': [el.key for el in store.chronolist] }
+
+class ElementPoint(Resource):
+ def get(self, key):
+ if key not in store.key_dict:
+ return { 'message': 'No such element'}, 404
+
+ el = store.key_dict[key]
+ return { 'key': key, 'value': el.value, 'ctime': str(el.ctime) }
+
+ def delete(self, key):
+ if key in store.key_dict:
+ store.remove(key)
+ return { 'message': 'ok'}
+
+ def post(self, key):
+ req = flask.request.get_json(force=True)
+
+ if 'value' not in req:
+ return {'message': 'No value given.'}, 403
+
+ el = store.insert(key, req['value'])
+ store.garbagecollect()
+ return { 'key': key, 'value': el.value, 'ctime': str(el.ctime) }
+
+
+# Map of keys to values
+store = ElementStore()
+
+app = flask.Flask(__name__)
+api = Api(app)
+api.add_resource(EntryPoint, "/")
+api.add_resource(ElementPoint, "/<key>")
+
--- /dev/null
+#!/bin/sh
+
+cp ./xprofile-udevinput ~/.xprofile-udevinput
+echo "You may source ~/.xprofile-udevinput in your ~/.xinitrc or so"
+
+cp ./xprofile-udevinput-monitor ~/.local/bin/
+cp ./xprofile-udevinput-monitor.service ~/.config/systemd/user/
+systemctl --user daemon-reload
+
+echo "You may call systemctl --user enable xprofile-udevinput-monitor.service"
--- /dev/null
+#!bin/sh
+# Load this script whenever a USB keyboard is attached
+
+xset r rate 200 60
+
+# Barrier needs this on client and server side
+setxkbmap -device `xinput list --id-only "Virtual core XTEST keyboard"` de
--- /dev/null
+#!/bin/sh
+
+set -e
+
+# For each add-event of input subsystem by udev call ~/.xprofile-keyboard
+udevadm monitor -u -s input | grep --line-buffered add | while read line; do
+ echo ">> $line"
+ sh ~/.xprofile-udevinput
+done
+
--- /dev/null
+[Unit]
+Description=xprofile-udevinput-monitor daemon
+After=multi-user.target
+
+[Service]
+Environment=DISPLAY=:0
+ExecStart=%h/.local/bin/xprofile-udevinput-monitor
+Restart=always
+RestartSec=10min
+
+[Install]
+WantedBy=default.target
--- /dev/null
+#!/bin/sh
+# Stolen from and based on Robert Cutajar
+# https://askubuntu.com/a/421718
+
+if [ "$#" == "0" ] ;
+then
+ echo "Session daemon missing command" >&2
+ echo "USAGE: $0 command [args...]"
+ echo "Executes given command with args only once per XDG seat (session)."
+ echo "Keeps PID and log of the executed command."
+ exit 1
+fi
+
+COMMAND=$1
+shift
+
+NAME="${COMMAND##*/}"
+PIDFILE=~/.cache/xsession-daemon/$NAME-$XDG_SEAT.pid
+LOGFILE=~/.cache/xsession-daemon/$NAME-$XDG_SEAT.log
+PID=""
+PIDDIR="${PIDFILE%/*}"
+LOGDIR="${LOGFILE%/*}"
+
+mkdir -p $PIDDIR
+if [ $? -ne 0 ]; then
+ echo "Session daemon PIDDIR not there: $PIDDIR" >&2
+ exit 2
+fi
+
+mkdir -p $LOGDIR
+if [ $? -ne 0 ]; then
+ echo "Session daemon LOGDIR not there: $LOGDIR" >&2
+ exit 2
+fi
+
+if [ -e "$PIDFILE" ] ; then
+ PID=`cat "$PIDFILE"`
+ echo "Session daemon '$NAME' PID found: $PID"
+
+ if pgrep -F "$PIDFILE" "${NAME}" >/dev/null ; then
+ echo "Session daemon '$NAME' was already running with PID $PID" >&2
+ exit 3
+ fi
+else
+ echo "Session daemon '$NAME' PIDFILE NOT found: $PIDFILE"
+fi
+
+
+echo "Session daemon running $COMMAND $* > $LOGFILE 2>&1"
+$COMMAND $* > "$LOGFILE" 2>&1 &
+PID=$!
+ERR=$?
+sleep 1
+
+if [ "$PID" ] && [ $ERR == 0 ] && kill -0 "$PID" 2>/dev/null; then
+ echo -n $PID > "$PIDFILE"
+ echo "Session daemon '$NAME' started with PID $PID"
+else
+ echo "Session daemon '$NAME' did not start or finished early. PID: $PID, ERR: $ERR" >&2
+ cat "$LOGFILE" >&2
+ exit 4
+fi