updated some aliases and scripts

This commit is contained in:
tke
2022-11-09 12:41:40 +01:00
parent d479d153b2
commit ccb43c39bc
3 changed files with 18 additions and 4 deletions

View File

@@ -5,7 +5,9 @@ alias '+'='pushd .'
alias -- '-'='popd'
[[ -f ~/.shell_aliases ]] && . ~/.shell_aliases
[[ -f ~/.config/z.sh ]] && . ~/.config/z.sh
[[ -f /home/tke/.http_proxy ]] && . /home/tke/.http_proxy #PROXY_A93JK2
[[ -f ~/.oh-my-zsh/plugins/z/z.sh ]] && . ~/.oh-my-zsh/plugins/z/z.sh && set $_Z_OWNER=$(whoami)
[[ -f ~/.cargo/bin/zoxide ]] && . <(~/.cargo/bin/zoxide init bash)
[[ -f ~/.http_proxy ]] && . /home/tke/.http_proxy #PROXY_A93JK2
[[ -f /usr/share/doc/fzf/examples/key-bindings.bash ]] && source /usr/share/doc/fzf/examples/key-bindings.bash
[[ -f /usr/share/doc/fzf/examples/completion.bash ]] && source /usr/share/doc/fzf/examples/completion.bash
HISTTIMEFORMAT="%F %T "

View File

@@ -43,3 +43,6 @@ function dockertags() { tags=`wget -q https://registry.hub.docker.com/v1/rep
alias pip='pip3'
alias python='python3'
alias usbb="usbguard list-devices -b"
alias searchpackage="apt-cache search '' | sort | cut --delimiter ' ' --fields 1 | fzf --multi --cycle --reverse --preview 'apt-cache show {1}' | xargs -r sudo apt install -y"
which exa >/dev/null && alias ll='exa -l --git --icons'

View File

@@ -16,12 +16,12 @@ def avgdiff(values):
c = sum([abs(x[0]-x[1]) for x in zip(a,b)])
return c/len(a)
aggregator('avgdiff', avgdiff)
vd.aggregator('avgdiff', avgdiff)
def distinct_list(values):
return [x for x in set(values)]
aggregator('distinct_list', distinct_list)
vd.aggregator('distinct_list', distinct_list)
def logtime(val):
a=str(val)
@@ -171,6 +171,15 @@ def ipinfo(ip, type="country"):
except:
return ""
def split_number2ip(number):
number=str(number)
import re
pattern=re.compile("^([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")
match = pattern.match(number)
if match:
return ".".join(match.groups())
else:
return number
@functools.lru_cache()
def mx_lookup(domain):