Merge branch 'master' of github.com:telmich/nsbin

This commit is contained in:
Nico Schottelius 2017-12-09 18:58:15 +01:00
commit a895a3c27d
10 changed files with 131 additions and 53 deletions

74
dcl-rdns-generate.py Executable file
View file

@ -0,0 +1,74 @@
#!/usr/bin/env python3
import ipaddress
import sys
def hexstr2int(string):
return int(string.replace(':', ''), 16)
FIRST_MAC = hexstr2int('02:00:b3:39:79:4d')
FIRST_V4 = ipaddress.ip_address('185.203.112.2')
FIRST_V6 = "2a0a:e5c0:0:2:400:b3ff:fe39:794d"
V6_NAT64_BASE = ipaddress.ip_address("2a0a:e5c0:0:1:0:1::")
def v4_from_mac(mac):
"""Calculates the IPv4 address from a MAC address.
mac: string (the colon-separated representation)
returns: ipaddress.ip_address object with the v4 address
"""
return FIRST_V4 + (hexstr2int(mac) - FIRST_MAC)
def v4_from_v6(ipv6ip):
"""Calculates the IPv4 address from the IPv4 address
ipv6ip: the ip
returns: ipaddress.ip_address object with the v4 address
"""
return FIRST_V4 + (hexstr2int(ipv6ip) - (hexstr2int(FIRST_V6)))
def v6_from_v4(ipv4):
v4addr = ipaddress.ip_address(ipv4)
return V6_NAT64_BASE + int(v4addr)
if __name__ == "__main__":
first_addr = ipaddress.ip_address(sys.argv[1])
last_addr = ipaddress.ip_address(sys.argv[2])
while True:
addr = first_addr.reverse_pointer
name = "{}.place5.ungleich.ch".format(str(first_addr).replace(":",""))
record = "{}. IN PTR {}.".format(addr, name)
record = "{}. IN AAAA {}".format(name, first_addr)
print(record)
if first_addr == last_addr:
break
first_addr += 1
sys.exit(0)
out = []
try:
out.append(v4_from_v6(addr))
except:
pass
try:
out.append(v6_from_v4(addr))
except:
pass
print("{}".format(out))
# test.ch
# 2a0a:e5c0:0:1:0:1:504a:8a8c
# 80.74.138.140
# 1347062412
#

View file

@ -2,9 +2,10 @@
# Tue Jul 18 15:13:45 CEST 2017
securemail
#fetchmail
mbsync -a
#fetchmail
# Disabled by Mon Jun 20 10:56:19 CEST 2016 -- using mu now
# notmuch new

View file

@ -9,6 +9,9 @@
# i3lock -i ~/.background.png --dpms --nofork
# try to start - if it already runs it will just exit
xscreensaver &
if ! pgrep xscreensaver; then
xscreensaver -no-splash &
sleep 1
fi
xscreensaver-command -lock

View file

@ -33,24 +33,19 @@ if [ $# -ge 1 ]; then
HOST=$1; shift
fi
#ssh -T -f -C -N \
# -L4241:mx.ungleich.ch:$SMTP \
# -R :4242:localhost:22 \
# -D 3128 "$@" \
# "$HOST" && sendmail -q
#
ssh -T -f -C -N \
-L2323:mx.ungleich.ch:$IMAPS \
-L4241:mx.ungleich.ch:$SMTP \
-L[::1]:2323:localhost:$IMAPS \
-L[::1]:4241:localhost:$SMTP \
-L2324:imap.googlemail.com:$IMAPS \
-L2325:mail.zhaw.ch:$IMAPS \
-L2326:imap.googlemail.com:$POP3S \
-R :4242:localhost:22 \
-D 3128 "$@" \
"$HOST" && sendmail -q
# Fernzugriff
# ssh -T -f -C -N -R4242:localhost:22 "$HOST"
# -D 3128 "$@" \
#ssh -T -f -C -N -L2342:mx2.schottelius.org:$SMTP 62.65.138.66
#ssh -T -f -C -N -L4242:imaps.schottelius.org:$IMAPS "$HOST"

View file

@ -1,14 +1,12 @@
#!/bin/sh
# Restore layouts
i3-msg 'workspace 1; append_layout /home/users/nico/.i3/workspace-1.json'
i3-msg 'workspace 2; append_layout /home/users/nico/.i3/workspace-2.json'
i3-msg 'workspace 10; append_layout /home/users/nico/.i3/workspace-10.json'
i3-msg 'workspace 1; append_layout ~/.i3/workspace-1.json'
i3-msg 'workspace 2; append_layout ~/.i3/workspace-2.json'
i3-msg 'workspace 10'
# Start programs afterwards and watch matching
chromium &
# slack &
#firefox &
#choqok &
ssh-add </dev/null && mainemacs &

View file

@ -1,12 +1,43 @@
#!/bin/sh
xinput set-prop "$(cat ~/.touchpad-name)" "libinput Natural Scrolling Enabled" 1
# XPS 13
# xinput set-prop "DLL0704:01 06CB:76AE Touchpad" "libinput Natural Scrolling Enabled" 1
# Only continue if there is wacom stuff
if ! xinput list | grep -i wacom -q; then
exit 0
fi
# lenovo x1 carbon 2016
xinput set-prop "" "libinput Natural Scrolling Enabled" 1
# xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Accel Speed" -0.5
if [ $# -eq 1 ]; then
display=$1
else
display=eDP1
fi
# Dell Latitude 5285
#xinput set-prop "" "libinput Natural Scrolling Enabled" 1
xsetwacom --set "Wacom HID 484C Finger touch" MapToOutput "$display"
xsetwacom --set "Wacom HID 484C Pen stylus" MapToOutput "$display"
if xinput list | grep -q Bamboo; then
devfinger="Wacom Bamboo 16FG 4x5 Finger touch"
xinput set-prop "$devfinger" "Device Enabled" 0
xsetwacom --set "Wacom Bamboo 16FG 4x5 Pen stylus" MapToOutput $display
xsetwacom --set "Wacom Bamboo 16FG 4x5 Pen eraser" MapToOutput $display
fi
exit 0
# xinput set-prop "Wacom Bamboo 16FG 4x5 Finger pad" "Device Enabled" 0
xsetwacom --set "Wacom Bamboo 16FG 4x5 Pen stylus" mode relative
xinput set-prop "Wacom Bamboo 16FG 4x5 Pen stylus" "Device Accel Constant Deceleration" 4
xinput set-prop "Wacom Bamboo 16FG 4x5 Pen stylus" "Device Accel Adaptive Deceleration" 2
# Rotate so usb cable is not disturbing me
# xinput set-prop 14 "Evdev Axis Inversion" 1 1
# xsetwacom --set "Wacom Bamboo 16FG 4x5 Pen" MapToOutput LVDS1
exit 0

View file

@ -12,8 +12,9 @@ arrival="2017-01-24"; event="Algolabs exam"
arrival="2017-01-30"; event="Algolabs exam 2"
arrival="2017-02-07"; event="syssec"
arrival="2017-08-21"; event="cil"
arrival="2017-09-25"; event="euler-reinstallation"
arrival="2018-02-02"; event="algolab-1"
export arrival event
python3 -c 'import os; import datetime; day=datetime.datetime.strptime(os.environ["arrival"], "%Y-%m-%d"); delta = day - datetime.datetime.now(); print("%s is %sd away" % (os.environ["event"], delta.days + 1))'
# python3 -c 'import os; import datetime; day=datetime.datetime.strptime(os.environ["arrival"], "%Y-%m-%d"); delta = day - datetime.datetime.now(); print("%s is %sd away" % (os.environ["event"], delta.days + 1))'

View file

@ -1,28 +0,0 @@
#!/bin/sh
if [ $# -eq 1 ]; then
display=$1
else
display=LVDS1
fi
devfinger="Wacom Bamboo 16FG 4x5 Finger"
xinput set-prop "$devfinger" "Device Enabled" 0
#xsetwacom --set "Wacom Bamboo 16FG 4x5 Pen stylus" MapToOutput $display
#xsetwacom --set "Wacom Bamboo 16FG 4x5 Pen eraser" MapToOutput $display
exit 0
# xinput set-prop "Wacom Bamboo 16FG 4x5 Finger pad" "Device Enabled" 0
xsetwacom --set "Wacom Bamboo 16FG 4x5 Pen stylus" mode relative
xinput set-prop "Wacom Bamboo 16FG 4x5 Pen stylus" "Device Accel Constant Deceleration" 4
xinput set-prop "Wacom Bamboo 16FG 4x5 Pen stylus" "Device Accel Adaptive Deceleration" 2
# Rotate so usb cable is not disturbing me
# xinput set-prop 14 "Evdev Axis Inversion" 1 1
# xsetwacom --set "Wacom Bamboo 16FG 4x5 Pen" MapToOutput LVDS1
exit 0

4
x-at-home Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
x-off
xrandr --output DP1 --right-of eDP1 --auto --rotate left

1
수산
View file

@ -1 +0,0 @@
/bin/ls