mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-15 04:53:28 +00:00
misc: .screenrc, config, functions & new scripts!
This commit is contained in:
@@ -56,6 +56,9 @@ alias watchx='watch -dpbc' # watch with: differences, precise, beep and color
|
|||||||
alias zapds='find . -name ".DS_Store" -print -delete'
|
alias zapds='find . -name ".DS_Store" -print -delete'
|
||||||
alias t='tail -f' # tail with follow flag on
|
alias t='tail -f' # tail with follow flag on
|
||||||
alias dn='du -chd1' # directory usage, return only the total
|
alias dn='du -chd1' # directory usage, return only the total
|
||||||
|
alias mirrorsite='wget -m -k -K -E -e robots=off' # Mirror site
|
||||||
|
# Mirror stdout to stderr, useful for seeing data going through a pipe
|
||||||
|
alias peek='tee >(cat 1>&2)'
|
||||||
|
|
||||||
alias code_scanner='docker run
|
alias code_scanner='docker run
|
||||||
--env SOURCE_CODE="$PWD"
|
--env SOURCE_CODE="$PWD"
|
||||||
|
|||||||
@@ -103,3 +103,5 @@ export _Z_DATA="$XDG_STATE_HOME/z"
|
|||||||
# Misc
|
# Misc
|
||||||
export ANDROID_HOME="$XDG_DATA_HOME/android"
|
export ANDROID_HOME="$XDG_DATA_HOME/android"
|
||||||
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
|
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
|
||||||
|
export SCREENRC="$XDG_CONFIG_HOME/misc/screenrc"
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,23 @@ function silent
|
|||||||
"$@" >&/dev/null
|
"$@" >&/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function path_remove
|
||||||
|
{
|
||||||
|
PATH=$(echo -n "$PATH" | awk -v RS=: -v ORS=: "\$0 != \"$1\"" | sed 's/:$//')
|
||||||
|
}
|
||||||
|
|
||||||
|
function path_append
|
||||||
|
{
|
||||||
|
path_remove "$1"
|
||||||
|
PATH="${PATH:+"$PATH:"}$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
function path_prepend
|
||||||
|
{
|
||||||
|
path_remove "$1"
|
||||||
|
PATH="$1${PATH:+":$PATH"}"
|
||||||
|
}
|
||||||
|
|
||||||
# Defines default antigen bundles
|
# Defines default antigen bundles
|
||||||
function x-default-antigen-bundles
|
function x-default-antigen-bundles
|
||||||
{
|
{
|
||||||
|
|||||||
16
config/misc/screenrc
Normal file
16
config/misc/screenrc
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Disable the startup message
|
||||||
|
startup_message off
|
||||||
|
|
||||||
|
# Set a large scrollback buffer
|
||||||
|
defscrollback 32000
|
||||||
|
|
||||||
|
# Always start `screen` with UTF-8 enabled (`screen -U`)
|
||||||
|
defutf8 on
|
||||||
|
|
||||||
|
# Scroll with mouse wheel (http://stackoverflow.com/a/1125947)
|
||||||
|
termcapinfo xterm* ti@:te@
|
||||||
|
|
||||||
|
# Some settings for screen + vim
|
||||||
|
term xterm-256color
|
||||||
|
maptimeout 10
|
||||||
|
|
||||||
57
local/bin/x-compare-versions.py
Executable file
57
local/bin/x-compare-versions.py
Executable file
@@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
"""
|
||||||
|
Version Comparison tool for the CLI.
|
||||||
|
|
||||||
|
Adapted from script found in anishathalye's dotfiles.
|
||||||
|
https://github.com/anishathalye/dotfiles/blob/master/bin/vercmp
|
||||||
|
"""
|
||||||
|
|
||||||
|
import operator
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from packaging import version
|
||||||
|
|
||||||
|
str_to_operator = {
|
||||||
|
"==": operator.eq,
|
||||||
|
"!=": operator.ne,
|
||||||
|
"<": operator.lt,
|
||||||
|
"<=": operator.le,
|
||||||
|
">": operator.gt,
|
||||||
|
">=": operator.ge,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def vercmp(expr):
|
||||||
|
"""Version Comparison function."""
|
||||||
|
words = expr.split()
|
||||||
|
comparisons = [words[i: i + 3] for i in range(0, len(words) - 2, 2)]
|
||||||
|
for left, op_str, right in comparisons:
|
||||||
|
compare_op = str_to_operator[op_str]
|
||||||
|
if not compare_op(version.parse(left), version.parse(right)):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Triggers version comparison if line is provided."""
|
||||||
|
for line in sys.stdin:
|
||||||
|
if not vercmp(line):
|
||||||
|
sys.exit(1)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
def test():
|
||||||
|
"""Basic functionality tests."""
|
||||||
|
assert not vercmp("1.9 >= 2.4")
|
||||||
|
assert vercmp("2.4 >= 2.4")
|
||||||
|
assert vercmp("2.5 >= 2.4")
|
||||||
|
assert vercmp("3 >= 2.999")
|
||||||
|
assert vercmp("2.9 < 2.9a")
|
||||||
|
assert vercmp("2.9a >= 2.8")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) == 2 and sys.argv[1] == "test":
|
||||||
|
test()
|
||||||
|
else:
|
||||||
|
main()
|
||||||
5
local/bin/x-ip
Executable file
5
local/bin/x-ip
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Source: https://github.com/thirtythreeforty/dotfiles/blob/master/bin/extip
|
||||||
|
|
||||||
|
curl icanhazip.com "${@}"
|
||||||
|
|
||||||
Reference in New Issue
Block a user