Reorganise gists folder
This commit is contained in:
228
systemscripts/agnoster.zsh-theme
Normal file
228
systemscripts/agnoster.zsh-theme
Normal file
@@ -0,0 +1,228 @@
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
#
|
||||
# agnoster's Theme - https://gist.github.com/3712874
|
||||
# A Powerline-inspired theme for ZSH
|
||||
#
|
||||
# # README
|
||||
#
|
||||
# In order for this theme to render correctly, you will need a
|
||||
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
|
||||
# Make sure you have a recent version: the code points that Powerline
|
||||
# uses changed in 2012, and older versions will display incorrectly,
|
||||
# in confusing ways.
|
||||
#
|
||||
# In addition, I recommend the
|
||||
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're
|
||||
# using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app -
|
||||
# it has significantly better color fidelity.
|
||||
#
|
||||
# # Goals
|
||||
#
|
||||
# The aim of this theme is to only show you *relevant* information. Like most
|
||||
# prompts, it will only show git information when in a git working directory.
|
||||
# However, it goes a step further: everything from the current user and
|
||||
# hostname to whether the last call exited with an error to whether background
|
||||
# jobs are running in this shell will all be displayed automatically when
|
||||
# appropriate.
|
||||
|
||||
### Segment drawing
|
||||
# A few utility functions to make it easy and re-usable to draw segmented prompts
|
||||
|
||||
CURRENT_BG='NONE'
|
||||
|
||||
# Special Powerline characters
|
||||
|
||||
() {
|
||||
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
|
||||
# NOTE: This segment separator character is correct. In 2012, Powerline changed
|
||||
# the code points they use for their special characters. This is the new code point.
|
||||
# If this is not working for you, you probably have an old version of the
|
||||
# Powerline-patched fonts installed. Download and install the new version.
|
||||
# Do not submit PRs to change this unless you have reviewed the Powerline code point
|
||||
# history and have new information.
|
||||
# This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of
|
||||
# what font the user is viewing this source code in. Do not replace the
|
||||
# escape sequence with a single literal character.
|
||||
# Do not change this! Do not make it '\u2b80'; that is the old, wrong code point.
|
||||
SEGMENT_SEPARATOR=$'\ue0b0'
|
||||
}
|
||||
|
||||
# Begin a segment
|
||||
# Takes two arguments, background and foreground. Both can be omitted,
|
||||
# rendering default background/foreground.
|
||||
prompt_segment() {
|
||||
local bg fg
|
||||
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
|
||||
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
|
||||
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
|
||||
echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
|
||||
else
|
||||
echo -n "%{$bg%}%{$fg%} "
|
||||
fi
|
||||
CURRENT_BG=$1
|
||||
[[ -n $3 ]] && echo -n $3
|
||||
}
|
||||
|
||||
# End the prompt, closing any open segments
|
||||
prompt_end() {
|
||||
if [[ -n $CURRENT_BG ]]; then
|
||||
echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
|
||||
else
|
||||
echo -n "%{%k%}"
|
||||
fi
|
||||
echo -n "%{%f%}"
|
||||
CURRENT_BG=''
|
||||
}
|
||||
|
||||
### Prompt components
|
||||
# Each component will draw itself, and hide itself if no information needs to be shown
|
||||
|
||||
# Context: user@hostname (who am I and where am I)
|
||||
prompt_context() {
|
||||
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
||||
prompt_segment black default "%T %(!.%{%F{red}%}.)$USER"
|
||||
fi
|
||||
}
|
||||
|
||||
# Git: branch/detached head, dirty status
|
||||
prompt_git() {
|
||||
(( $+commands[git] )) || return
|
||||
local PL_BRANCH_CHAR
|
||||
() {
|
||||
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
|
||||
PL_BRANCH_CHAR=$'\ue0a0' #
|
||||
}
|
||||
local ref dirty mode repo_path
|
||||
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
||||
|
||||
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||
dirty=$(parse_git_dirty)
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
|
||||
if [[ -n $dirty ]]; then
|
||||
prompt_segment yellow black
|
||||
else
|
||||
prompt_segment green black
|
||||
fi
|
||||
|
||||
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
|
||||
mode=" <B>"
|
||||
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then
|
||||
mode=" >M<"
|
||||
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then
|
||||
mode=" >R>"
|
||||
fi
|
||||
|
||||
setopt promptsubst
|
||||
autoload -Uz vcs_info
|
||||
|
||||
zstyle ':vcs_info:*' enable git
|
||||
zstyle ':vcs_info:*' get-revision true
|
||||
zstyle ':vcs_info:*' check-for-changes true
|
||||
zstyle ':vcs_info:*' stagedstr '✚'
|
||||
zstyle ':vcs_info:*' unstagedstr '●'
|
||||
zstyle ':vcs_info:*' formats ' %u%c'
|
||||
zstyle ':vcs_info:*' actionformats ' %u%c'
|
||||
vcs_info
|
||||
echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_bzr() {
|
||||
(( $+commands[bzr] )) || return
|
||||
if (bzr status >/dev/null 2>&1); then
|
||||
status_mod=`bzr status | head -n1 | grep "modified" | wc -m`
|
||||
status_all=`bzr status | head -n1 | wc -m`
|
||||
revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'`
|
||||
if [[ $status_mod -gt 0 ]] ; then
|
||||
prompt_segment yellow black
|
||||
echo -n "bzr@"$revision "✚ "
|
||||
else
|
||||
if [[ $status_all -gt 0 ]] ; then
|
||||
prompt_segment yellow black
|
||||
echo -n "bzr@"$revision
|
||||
|
||||
else
|
||||
prompt_segment green black
|
||||
echo -n "bzr@"$revision
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_hg() {
|
||||
(( $+commands[hg] )) || return
|
||||
local rev status
|
||||
if $(hg id >/dev/null 2>&1); then
|
||||
if $(hg prompt >/dev/null 2>&1); then
|
||||
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
||||
# if files are not added
|
||||
prompt_segment red white
|
||||
st='±'
|
||||
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
||||
# if any modification
|
||||
prompt_segment yellow black
|
||||
st='±'
|
||||
else
|
||||
# if working copy is clean
|
||||
prompt_segment green black
|
||||
fi
|
||||
echo -n $(hg prompt "☿ {rev}@{branch}") $st
|
||||
else
|
||||
st=""
|
||||
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||
branch=$(hg id -b 2>/dev/null)
|
||||
if `hg st | grep -q "^\?"`; then
|
||||
prompt_segment red black
|
||||
st='±'
|
||||
elif `hg st | grep -q "^[MA]"`; then
|
||||
prompt_segment yellow black
|
||||
st='±'
|
||||
else
|
||||
prompt_segment green black
|
||||
fi
|
||||
echo -n "☿ $rev@$branch" $st
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Dir: current working directory
|
||||
prompt_dir() {
|
||||
prompt_segment blue black '%~'
|
||||
}
|
||||
|
||||
# Virtualenv: current working virtualenv
|
||||
prompt_virtualenv() {
|
||||
local virtualenv_path="$VIRTUAL_ENV"
|
||||
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
|
||||
prompt_segment blue black "(`basename $virtualenv_path`)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Status:
|
||||
# - was there an error
|
||||
# - am I root
|
||||
# - are there background jobs?
|
||||
prompt_status() {
|
||||
local symbols
|
||||
symbols=()
|
||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
|
||||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
||||
|
||||
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
|
||||
}
|
||||
|
||||
## Main prompt
|
||||
build_prompt() {
|
||||
RETVAL=$?
|
||||
prompt_status
|
||||
prompt_virtualenv
|
||||
prompt_context
|
||||
prompt_dir
|
||||
prompt_git
|
||||
prompt_bzr
|
||||
prompt_hg
|
||||
prompt_end
|
||||
}
|
||||
|
||||
PROMPT='%{%f%b%k%}$(build_prompt) '
|
||||
76
systemscripts/automountctl
Executable file
76
systemscripts/automountctl
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
command="${1}"
|
||||
|
||||
# test if gsettings tool is installed
|
||||
if ! (which gsettings 1>/dev/null) ; then
|
||||
echo "need gsettings"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#test for existing mate settings
|
||||
if (gsettings get org.mate.media-handling automount 1>/dev/null 2>/dev/null) ; then
|
||||
mate=1
|
||||
fi
|
||||
|
||||
#test for existing gnome settings
|
||||
if (gsettings get org.gnome.desktop.media-handling automount 1>/dev/null 2>/dev/null) ; then
|
||||
gnome=1
|
||||
fi
|
||||
|
||||
#test if at least one of the known settings where found
|
||||
if [ -z $mate ] && [ -z $gnome ] ; then
|
||||
echo "No supported Settings found"
|
||||
echo "mate : org.mate.media-handling automount"
|
||||
echo "gnome: org.gnome.desktop.media-handling automount"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case ${command} in
|
||||
on)
|
||||
echo "turning on"
|
||||
if [[ $mate -eq "1" ]] ; then
|
||||
gsettings set org.mate.media-handling automount true
|
||||
gsettings set org.mate.media-handling automount-open true
|
||||
fi
|
||||
if [[ $gnome -eq "1" ]] ; then
|
||||
gsettings set org.gnome.desktop.media-handling automount true
|
||||
gsettings set org.gnome.desktop.media-handling automount-open true
|
||||
fi
|
||||
;;
|
||||
off)
|
||||
echo "turning off"
|
||||
if [[ $mate -eq "1" ]] ; then
|
||||
gsettings set org.mate.media-handling automount false
|
||||
gsettings set org.mate.media-handling automount-open false
|
||||
fi
|
||||
if [[ $gnome -eq "1" ]] ; then
|
||||
gsettings set org.gnome.desktop.media-handling automount false
|
||||
gsettings set org.gnome.desktop.media-handling automount-open false
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Status:"
|
||||
if [[ $mate -eq "1" ]] ; then
|
||||
echo "# mate-settings found:"
|
||||
echo " - org.mate.media-handling automount :"
|
||||
echo -n " "
|
||||
gsettings get org.mate.media-handling automount
|
||||
echo " - org.mate.media-handling automount-open :"
|
||||
echo -n " "
|
||||
gsettings get org.mate.media-handling automount-open
|
||||
fi
|
||||
|
||||
if [[ $gnome -eq "1" ]] ; then
|
||||
echo "# gnome-settings found:"
|
||||
echo " - org.gnome.desktop.media-handling automount :"
|
||||
echo -n " "
|
||||
gsettings get org.gnome.desktop.media-handling automount
|
||||
echo " - org.gnome.desktop.media-handling automount-open :"
|
||||
echo -n " "
|
||||
gsettings get org.gnome.desktop.media-handling automount-open
|
||||
fi
|
||||
echo "-------------------"
|
||||
echo "usage:"
|
||||
echo " $0 on : turn on automount"
|
||||
echo " $0 off : turn off automount"
|
||||
esac
|
||||
2
systemscripts/fullhd
Executable file
2
systemscripts/fullhd
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
xrandr --output eDP-1 --mode 1920x1080
|
||||
143
systemscripts/mount_container
Executable file
143
systemscripts/mount_container
Executable file
@@ -0,0 +1,143 @@
|
||||
#!/bin/bash
|
||||
## Functions
|
||||
#find containers
|
||||
containers=""
|
||||
commands=""
|
||||
|
||||
function read_containers(){
|
||||
containers=$(
|
||||
[ -e ~/.containers ] && cat ~/.containers 2>/dev/null
|
||||
find /media/${USER} -maxdepth 2 -iname ".containers" | while read line ; do
|
||||
cat $line | awk -F';' -v path="$(dirname $line)" '{OFS=";" ; print $1,path"/"$2}'
|
||||
done)
|
||||
}
|
||||
|
||||
function mount_container(){
|
||||
container_line=$*
|
||||
name=$(echo $container_line | cut -f1 -d';')
|
||||
path=$(echo $container_line | cut -f2 -d';')
|
||||
mount_point="/mnt/${name}"
|
||||
|
||||
#mount only if containerfile is valid
|
||||
if [ -e ${path} ] && cryptsetup isLuks "${path}" ; then
|
||||
#if mountpoint is not there create it
|
||||
[ ! -e ${mount_point} ] && sudo mkdir -p "${mount_point}" && sudo chmod 777 "${mount_point}"
|
||||
#open luks Container
|
||||
sudo cryptsetup luksOpen "${path}" "${name}"
|
||||
#mount Container
|
||||
sudo mount "/dev/mapper/${name}" "${mount_point}"
|
||||
else
|
||||
echo "Container ${path} not found" && continue
|
||||
fi
|
||||
}
|
||||
|
||||
function unmount_container(){
|
||||
container_line=$*
|
||||
name=$(echo $container_line | cut -f1 -d';')
|
||||
path=$(echo $container_line | cut -f2 -d';')
|
||||
mount_point="/mnt/${name}"
|
||||
|
||||
#unmount only if mounted
|
||||
if ( mount | grep -q "${mount_point}" ) ; then
|
||||
#if still in use
|
||||
if [[ $( lsof "${mount_point}" | wc -l ) -gt 0 ]] ; then
|
||||
echo "Mountpoint ${mount_point} is still in use:"
|
||||
lsof "${mount_point}"
|
||||
continue
|
||||
else
|
||||
sudo umount -l "${mount_point}"
|
||||
sudo rmdir "${mount_point}"
|
||||
fi
|
||||
|
||||
sudo cryptsetup luksClose "${name}"
|
||||
fi
|
||||
}
|
||||
|
||||
function is_open(){
|
||||
container_path="${1}"
|
||||
ls -b /dev/mapper/ | xargs -n1 sudo cryptsetup status | grep loop: | grep -q "${container_path}"
|
||||
return $?
|
||||
}
|
||||
|
||||
function is_mounted(){
|
||||
mount_point="${1}"
|
||||
mount | grep -q "${mount_point}"
|
||||
return $?
|
||||
}
|
||||
|
||||
function is_used(){
|
||||
mount_point="${1}"
|
||||
lsof ${mount_point} 2>/dev/null 1>&2
|
||||
return $?
|
||||
}
|
||||
|
||||
function is_mounted_container(){
|
||||
container_line=$*
|
||||
name=$(echo $container_line | cut -f1 -d';')
|
||||
path=$(echo $container_line | cut -f2 -d';')
|
||||
mount_point="/mnt/${name}"
|
||||
result=0
|
||||
mount | grep -q "${mount_point}" && (( result+=1 ))
|
||||
sudo cryptsetup status ${name} | grep -q "${path}" && (( result+=2 ))
|
||||
echo $result
|
||||
return $result
|
||||
}
|
||||
|
||||
#mount all containers
|
||||
function mount_all(){
|
||||
read_containers
|
||||
for line in $containers ; do
|
||||
mount_container $line
|
||||
done
|
||||
}
|
||||
|
||||
#unmount all containers
|
||||
function unmount_all(){
|
||||
read_containers
|
||||
for line in $containers ; do
|
||||
unmount_container $line
|
||||
done
|
||||
}
|
||||
|
||||
#print status
|
||||
function print_status(){
|
||||
container_line=$*
|
||||
name=$(echo $container_line | cut -f1 -d';')
|
||||
path=$(echo $container_line | cut -f2 -d';')
|
||||
mount_point="/mnt/${name}"
|
||||
echo "Stats for $name : $path"
|
||||
is_open ${path} && echo "IS OPENED"
|
||||
is_mounted ${mount_point} && echo "IS MOUNTED"
|
||||
is_used ${mount_point} && echo "IS IN USE"
|
||||
}
|
||||
|
||||
#print status
|
||||
function print_status_all(){
|
||||
read_containers
|
||||
for line in $containers ; do
|
||||
print_status $line
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
##main
|
||||
|
||||
command="show"
|
||||
[[ $# -eq 1 ]] && command="${1}"
|
||||
echo "Command: ${command}"
|
||||
|
||||
case $command in
|
||||
mount)
|
||||
mount_all
|
||||
;;
|
||||
unmount)
|
||||
unmount_all
|
||||
;;
|
||||
list)
|
||||
print_status_all
|
||||
;;
|
||||
*)
|
||||
read_containers
|
||||
echo $containers
|
||||
;;
|
||||
esac
|
||||
21
systemscripts/proxy/get_proxy.sh
Normal file
21
systemscripts/proxy/get_proxy.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
proxy_ip=$(env | grep http_proxy | grep -Pio '[^@/:]+(?=:\d+/?$)')
|
||||
proxy_port=$(env | grep http_proxy | grep -Pio '(?<=:)(\d+)(?=/?$)')
|
||||
|
||||
if [ -z "${proxy_ip}" ]; then
|
||||
echo "Enter Proxy IP or Hostname (no port): "
|
||||
read proxy_ip
|
||||
else
|
||||
echo "Using >>${proxy_ip}<< as Proxy-Address"
|
||||
fi
|
||||
|
||||
if [ -z "${proxy_port}" ]; then
|
||||
echo -n "Proxy-Port: "
|
||||
read proxy_port
|
||||
else
|
||||
echo "Using >>${proxy_port}<< as Proxy-Port"
|
||||
fi
|
||||
|
||||
echo "Using ${proxy_ip}:${proxy_port} as Proxy!"
|
||||
|
||||
21
systemscripts/proxy/update_apt_proxy.sh
Executable file
21
systemscripts/proxy/update_apt_proxy.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
config_file='/etc/apt/apt.conf.d/80certproxy'
|
||||
#remove proxy settings from docker
|
||||
if [[ "${1}" == "off" ]]; then
|
||||
echo "TURNING OFF PROXY FOR APT"
|
||||
sudo rm -rf "${config_file}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#populate proxy_ip and proxy_port variables
|
||||
path=$(dirname $(readlink -f "${0}"))
|
||||
. "${path}/get_proxy.sh"
|
||||
|
||||
|
||||
echo -n "Username: "
|
||||
read username
|
||||
echo -n "Password: "
|
||||
read -s password
|
||||
encpassword=$(echo -n ${password} | xxd -p | sed -e 's/\(..\)/%\1/g' )
|
||||
echo 'Acquire::http::Proxy "http://'"${username}:${encpassword}@${proxy_ip}:${proxy_port}/"'";' | sudo tee "${config_file}"
|
||||
echo 'Acquire::http::Timeout "360";' | sudo tee -a "${config_file}"
|
||||
49
systemscripts/proxy/update_bashrc_proxy.sh
Executable file
49
systemscripts/proxy/update_bashrc_proxy.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
user=$(logname)
|
||||
bashrc_file=/home/${user}/.bashrc
|
||||
proxy_file=/home/${user}/.http_proxy
|
||||
noproxy_file=/home/${user}/.http_noproxy
|
||||
|
||||
#turn off bashrc proxy settings
|
||||
if [[ "${1}" == "off" ]]; then
|
||||
echo "TURNING OFF PROXY IN BASHRC"
|
||||
mv -v "${proxy_file}" "${proxy_file}.off"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#turn on bashrc proxy settings
|
||||
if [[ "${1}" == "on" ]]; then
|
||||
if [[ -f "${proxy_file}.off" ]] ; then
|
||||
echo "TURNING ON PROXY IN BASHRC"
|
||||
mv -v "${proxy_file}.off" "${proxy_file}"
|
||||
exit 0
|
||||
else
|
||||
echo "No disabled Proxy-Config found. Creating a new one!"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
marker="#PROXY_A93JK2"
|
||||
path=$(dirname $(readlink -f "${0}"))
|
||||
. "${path}/get_proxy.sh"
|
||||
echo -n "Username: "
|
||||
read username
|
||||
echo -n "Password: "
|
||||
read -s password
|
||||
|
||||
|
||||
encpassword=$(echo -n ${password} | xxd -p | sed -e 's/\(..\)/%\1/g' )
|
||||
|
||||
if ! grep -qF -e "PROXY_A93JK2" "${bashrc_file}" ; then
|
||||
echo "[ -f ${proxy_file} ] && . ${proxy_file} #PROXY_A93JK2" >> "${bashrc_file}"
|
||||
fi
|
||||
|
||||
echo 'export "HTTP_PROXY=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" > "${proxy_file}"
|
||||
echo 'export "HTTPS_PROXY=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" >> "${proxy_file}"
|
||||
echo 'export "http_proxy=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" >> "${proxy_file}"
|
||||
echo 'export "https_proxy=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" >> "${proxy_file}"
|
||||
echo 'export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt' >> "${proxy_file}"
|
||||
echo "[ -f ${noproxy_file} ] && . ${noproxy_file}" >> "${proxy_file}"
|
||||
|
||||
[ -f "${noproxy_file}" ] || echo 'export "NO_PROXY=localhost,127.0.0.1"' > "${noproxy_file}"
|
||||
|
||||
42
systemscripts/proxy/update_docker_proxy.sh
Executable file
42
systemscripts/proxy/update_docker_proxy.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
function restart_docker(){
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart docker
|
||||
#systemctl show docker -p Environment
|
||||
}
|
||||
|
||||
#remove proxy settings from docker
|
||||
if [[ "${1}" == "off" ]]; then
|
||||
echo "TURNING OFF PROXY FOR DOCKER"
|
||||
sudo rm -v /etc/systemd/system/docker.service.d/http-proxy.conf
|
||||
restart_docker
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#populate proxy_ip and proxy_port variables
|
||||
path=$(dirname $(readlink -f "${0}"))
|
||||
. "${path}/get_proxy.sh"
|
||||
|
||||
|
||||
echo -n "Username: "
|
||||
read username
|
||||
echo -n "Password: "
|
||||
read -s password
|
||||
#encpassword=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "${password}")
|
||||
#encpassword=$(echo -n ${password} | sed -e 's/\@/\\x40/g' -e 's/\!/\\x21/g' -e 's/\$/\\x24/g' -e 's/\*/\\x2a/g' -e 's/\%/\\x25/g' -e 's/\&/\\x26/g' -e 's/\#/\\x30/g')
|
||||
encpassword=$(echo -n ${password} | xxd -p | sed -e 's/\(..\)/%%\1/g' )
|
||||
if ! [[ -d "/etc/systemd/system/docker.service.d" ]] ; then
|
||||
sudo mkdir -p /etc/systemd/system/docker.service.d/
|
||||
fi
|
||||
echo "[Service]" | sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf >/dev/null
|
||||
echo 'Environment="HTTP_PROXY=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf >/dev/null
|
||||
echo 'Environment="HTTPS_PROXY=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf >/dev/null
|
||||
if [[ -z "$NO_PROXY" ]] ; then
|
||||
echo -n 'Environment="NO_PROXY=localhost,127.0.0.1"' | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf >/dev/null
|
||||
else
|
||||
echo 'Environment="'$(env | grep NO_PROXY)'"' | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf >/dev/null
|
||||
fi
|
||||
|
||||
restart_docker
|
||||
4
systemscripts/reset_screens.sh
Executable file
4
systemscripts/reset_screens.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
xrandr --output DVI-I-1 --mode 1920x1080 --rotate left --pos 0x0
|
||||
xrandr --output DP-1 --primary --mode 2560x1440 --pos 1080x350
|
||||
xrandr --output DP-2 --mode 2560x1440 --pos 3640x350
|
||||
6
systemscripts/share.sh
Executable file
6
systemscripts/share.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
#ifconfig eth1 10.10.10.1/24
|
||||
sysctl -w net.ipv4.conf.all.forwarding=1
|
||||
iptables -t nat -F
|
||||
iptables -t nat -A POSTROUTING -o eno1 -j MASQUERADE
|
||||
|
||||
480
systemscripts/solarized.dircolors
Normal file
480
systemscripts/solarized.dircolors
Normal file
@@ -0,0 +1,480 @@
|
||||
# Exact Solarized Dark color theme for the color GNU ls utility.
|
||||
# Designed for dircolors (GNU coreutils) 5.97
|
||||
#
|
||||
# This simple theme was simultaneously designed for these terminal color schemes:
|
||||
# - Solarized dark (best)
|
||||
# - Solarized light
|
||||
# - default dark
|
||||
# - default light
|
||||
# with a slight optimization for Solarized Dark.
|
||||
#
|
||||
# How the colors were selected:
|
||||
# - Terminal emulators often have an option typically enabled by default that makes
|
||||
# bold a different color. It is important to leave this option enabled so that
|
||||
# you can access the entire 16-color Solarized palette, and not just 8 colors.
|
||||
# - We favor universality over a greater number of colors. So we limit the number
|
||||
# of colors so that this theme will work out of the box in all terminals,
|
||||
# Solarized or not, dark or light.
|
||||
# - We choose to have the following category of files:
|
||||
# NORMAL & FILE, DIR, LINK, EXEC and
|
||||
# editable text including source, unimportant text, binary docs & multimedia source
|
||||
# files, viewable multimedia, archived/compressed, and unimportant non-text
|
||||
# - For uniqueness, we stay away from the Solarized foreground colors are -- either
|
||||
# base00 (brightyellow) or base0 (brightblue). However, they can be used if
|
||||
# you know what the bg/fg colors of your terminal are, in order to optimize the display.
|
||||
# - 3 different options are provided: universal, solarized dark, and solarized light.
|
||||
# The only difference between the universal scheme and one that's optimized for
|
||||
# dark/light is the color of "unimportant" files, which should blend more with the
|
||||
# background
|
||||
# - We note that blue is the hardest color to see on dark bg and yellow is the hardest
|
||||
# color to see on light bg (with blue being particularly bad). So we choose yellow
|
||||
# for multimedia files which are usually accessed in a GUI folder browser anyway.
|
||||
# And blue is kept for custom use of this scheme's user.
|
||||
# - See table below to see the assignments.
|
||||
|
||||
|
||||
# Installation instructions:
|
||||
# This file goes in the /etc directory, and must be world readable.
|
||||
# You can copy this file to .dir_colors in your $HOME directory to override
|
||||
# the system defaults.
|
||||
|
||||
# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
|
||||
# pipes. 'all' adds color characters to all output. 'none' shuts colorization
|
||||
# off.
|
||||
COLOR tty
|
||||
|
||||
# Below, there should be one TERM entry for each termtype that is colorizable
|
||||
TERM ansi
|
||||
TERM color_xterm
|
||||
TERM color-xterm
|
||||
TERM con132x25
|
||||
TERM con132x30
|
||||
TERM con132x43
|
||||
TERM con132x60
|
||||
TERM con80x25
|
||||
TERM con80x28
|
||||
TERM con80x30
|
||||
TERM con80x43
|
||||
TERM con80x50
|
||||
TERM con80x60
|
||||
TERM cons25
|
||||
TERM console
|
||||
TERM cygwin
|
||||
TERM dtterm
|
||||
TERM dvtm
|
||||
TERM dvtm-256color
|
||||
TERM Eterm
|
||||
TERM eterm-color
|
||||
TERM fbterm
|
||||
TERM gnome
|
||||
TERM gnome-256color
|
||||
TERM jfbterm
|
||||
TERM konsole
|
||||
TERM konsole-256color
|
||||
TERM kterm
|
||||
TERM linux
|
||||
TERM linux-c
|
||||
TERM mach-color
|
||||
TERM mlterm
|
||||
TERM nxterm
|
||||
TERM putty
|
||||
TERM putty-256color
|
||||
TERM rxvt
|
||||
TERM rxvt-256color
|
||||
TERM rxvt-cygwin
|
||||
TERM rxvt-cygwin-native
|
||||
TERM rxvt-unicode
|
||||
TERM rxvt-unicode256
|
||||
TERM rxvt-unicode-256color
|
||||
TERM screen
|
||||
TERM screen-16color
|
||||
TERM screen-16color-bce
|
||||
TERM screen-16color-s
|
||||
TERM screen-16color-bce-s
|
||||
TERM screen-256color
|
||||
TERM screen-256color-bce
|
||||
TERM screen-256color-s
|
||||
TERM screen-256color-bce-s
|
||||
TERM screen-256color-italic
|
||||
TERM screen-bce
|
||||
TERM screen-w
|
||||
TERM screen.linux
|
||||
TERM screen.xterm-256color
|
||||
TERM screen.xterm-new
|
||||
TERM st
|
||||
TERM st-meta
|
||||
TERM st-256color
|
||||
TERM st-meta-256color
|
||||
TERM tmux
|
||||
TERM tmux-256color
|
||||
TERM vt100
|
||||
TERM xterm
|
||||
TERM xterm-new
|
||||
TERM xterm-16color
|
||||
TERM xterm-256color
|
||||
TERM xterm-256color-italic
|
||||
TERM xterm-88color
|
||||
TERM xterm-color
|
||||
TERM xterm-debian
|
||||
TERM xterm-termite
|
||||
|
||||
# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
|
||||
EIGHTBIT 1
|
||||
|
||||
#############################################################################
|
||||
# Below are the color init strings for the basic file types. A color init
|
||||
# string consists of one or more of the following numeric codes:
|
||||
#
|
||||
# Attribute codes:
|
||||
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
|
||||
# Text color codes:
|
||||
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
|
||||
# Background color codes:
|
||||
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
|
||||
#
|
||||
# NOTES:
|
||||
# - See http://www.oreilly.com/catalog/wdnut/excerpt/color_names.html
|
||||
# - Color combinations
|
||||
# ANSI Color code Solarized Notes Universal SolDark SolLight
|
||||
# ~~~~~~~~~~~~~~~ ~~~~~~~~~ ~~~~~ ~~~~~~~~~ ~~~~~~~ ~~~~~~~~
|
||||
# 00 none NORMAL, FILE <SAME> <SAME>
|
||||
# 30 black base02
|
||||
# 01;30 bright black base03 bg of SolDark
|
||||
# 31 red red docs & mm src <SAME> <SAME>
|
||||
# 01;31 bright red orange EXEC <SAME> <SAME>
|
||||
# 32 green green editable text <SAME> <SAME>
|
||||
# 01;32 bright green base01 unimportant text <SAME>
|
||||
# 33 yellow yellow unclear in light bg multimedia <SAME> <SAME>
|
||||
# 01;33 bright yellow base00 fg of SolLight unimportant non-text
|
||||
# 34 blue blue unclear in dark bg user customized <SAME> <SAME>
|
||||
# 01;34 bright blue base0 fg in SolDark unimportant text
|
||||
# 35 magenta magenta LINK <SAME> <SAME>
|
||||
# 01;35 bright magenta violet archive/compressed <SAME> <SAME>
|
||||
# 36 cyan cyan DIR <SAME> <SAME>
|
||||
# 01;36 bright cyan base1 unimportant non-text <SAME>
|
||||
# 37 white base2
|
||||
# 01;37 bright white base3 bg in SolLight
|
||||
# 05;37;41 unclear in Putty dark
|
||||
|
||||
|
||||
### By file type
|
||||
|
||||
# global default
|
||||
NORMAL 00
|
||||
# normal file
|
||||
FILE 00
|
||||
# directory
|
||||
DIR 34
|
||||
# 777 directory
|
||||
OTHER_WRITABLE 34;40
|
||||
# symbolic link
|
||||
LINK 35
|
||||
|
||||
# pipe, socket, block device, character device (blue bg)
|
||||
FIFO 30;44
|
||||
SOCK 35;44
|
||||
DOOR 35;44 # Solaris 2.5 and later
|
||||
BLK 33;44
|
||||
CHR 37;44
|
||||
|
||||
|
||||
#############################################################################
|
||||
### By file attributes
|
||||
|
||||
# Orphaned symlinks (blinking white on red)
|
||||
# Blink may or may not work (works on iTerm dark or light, and Putty dark)
|
||||
ORPHAN 05;37;41
|
||||
# ... and the files that orphaned symlinks point to (blinking white on red)
|
||||
MISSING 05;37;41
|
||||
|
||||
# files with execute permission
|
||||
EXEC 01;31 # Unix
|
||||
.cmd 01;31 # Win
|
||||
.exe 01;31 # Win
|
||||
.com 01;31 # Win
|
||||
.bat 01;31 # Win
|
||||
.reg 01;31 # Win
|
||||
.app 01;31 # OSX
|
||||
|
||||
#############################################################################
|
||||
### By extension
|
||||
|
||||
# List any file extensions like '.gz' or '.tar' that you would like ls
|
||||
# to colorize below. Put the extension, a space, and the color init string.
|
||||
# (and any comments you want to add after a '#')
|
||||
|
||||
### Text formats
|
||||
|
||||
# Text that we can edit with a regular editor
|
||||
.txt 32
|
||||
.org 32
|
||||
.md 32
|
||||
.mkd 32
|
||||
|
||||
# Source text
|
||||
.h 32
|
||||
.hpp 32
|
||||
.c 32
|
||||
.C 32
|
||||
.cc 32
|
||||
.cpp 32
|
||||
.cxx 32
|
||||
.objc 32
|
||||
.cl 32
|
||||
.sh 32
|
||||
.bash 32
|
||||
.csh 32
|
||||
.zsh 32
|
||||
.el 32
|
||||
.vim 32
|
||||
.java 32
|
||||
.pl 32
|
||||
.pm 32
|
||||
.py 32
|
||||
.rb 32
|
||||
.hs 32
|
||||
.php 32
|
||||
.htm 32
|
||||
.html 32
|
||||
.shtml 32
|
||||
.erb 32
|
||||
.haml 32
|
||||
.xml 32
|
||||
.rdf 32
|
||||
.css 32
|
||||
.sass 32
|
||||
.scss 32
|
||||
.less 32
|
||||
.js 32
|
||||
.coffee 32
|
||||
.man 32
|
||||
.0 32
|
||||
.1 32
|
||||
.2 32
|
||||
.3 32
|
||||
.4 32
|
||||
.5 32
|
||||
.6 32
|
||||
.7 32
|
||||
.8 32
|
||||
.9 32
|
||||
.l 32
|
||||
.n 32
|
||||
.p 32
|
||||
.pod 32
|
||||
.tex 32
|
||||
.go 32
|
||||
.sql 32
|
||||
.csv 32
|
||||
.sv 32
|
||||
.svh 32
|
||||
.v 32
|
||||
.vh 32
|
||||
.vhd 32
|
||||
|
||||
### Multimedia formats
|
||||
|
||||
# Image
|
||||
.bmp 33
|
||||
.cgm 33
|
||||
.dl 33
|
||||
.dvi 33
|
||||
.emf 33
|
||||
.eps 33
|
||||
.gif 33
|
||||
.jpeg 33
|
||||
.jpg 33
|
||||
.JPG 33
|
||||
.mng 33
|
||||
.pbm 33
|
||||
.pcx 33
|
||||
.pdf 33
|
||||
.pgm 33
|
||||
.png 33
|
||||
.PNG 33
|
||||
.ppm 33
|
||||
.pps 33
|
||||
.ppsx 33
|
||||
.ps 33
|
||||
.svg 33
|
||||
.svgz 33
|
||||
.tga 33
|
||||
.tif 33
|
||||
.tiff 33
|
||||
.xbm 33
|
||||
.xcf 33
|
||||
.xpm 33
|
||||
.xwd 33
|
||||
.xwd 33
|
||||
.yuv 33
|
||||
|
||||
# Audio
|
||||
.aac 33
|
||||
.au 33
|
||||
.flac 33
|
||||
.m4a 33
|
||||
.mid 33
|
||||
.midi 33
|
||||
.mka 33
|
||||
.mp3 33
|
||||
.mpa 33
|
||||
.mpeg 33
|
||||
.mpg 33
|
||||
.ogg 33
|
||||
.opus 33
|
||||
.ra 33
|
||||
.wav 33
|
||||
|
||||
# Video
|
||||
.anx 33
|
||||
.asf 33
|
||||
.avi 33
|
||||
.axv 33
|
||||
.flc 33
|
||||
.fli 33
|
||||
.flv 33
|
||||
.gl 33
|
||||
.m2v 33
|
||||
.m4v 33
|
||||
.mkv 33
|
||||
.mov 33
|
||||
.MOV 33
|
||||
.mp4 33
|
||||
.mp4v 33
|
||||
.mpeg 33
|
||||
.mpg 33
|
||||
.nuv 33
|
||||
.ogm 33
|
||||
.ogv 33
|
||||
.ogx 33
|
||||
.qt 33
|
||||
.rm 33
|
||||
.rmvb 33
|
||||
.swf 33
|
||||
.vob 33
|
||||
.webm 33
|
||||
.wmv 33
|
||||
|
||||
### Misc
|
||||
|
||||
# Binary document formats and multimedia source
|
||||
.doc 31
|
||||
.docx 31
|
||||
.rtf 31
|
||||
.odt 31
|
||||
.dot 31
|
||||
.dotx 31
|
||||
.ott 31
|
||||
.xls 31
|
||||
.xlsx 31
|
||||
.ods 31
|
||||
.ots 31
|
||||
.ppt 31
|
||||
.pptx 31
|
||||
.odp 31
|
||||
.otp 31
|
||||
.fla 31
|
||||
.psd 31
|
||||
|
||||
# Archives, compressed
|
||||
.7z 1;35
|
||||
.apk 1;35
|
||||
.arj 1;35
|
||||
.bin 1;35
|
||||
.bz 1;35
|
||||
.bz2 1;35
|
||||
.cab 1;35 # Win
|
||||
.deb 1;35
|
||||
.dmg 1;35 # OSX
|
||||
.gem 1;35
|
||||
.gz 1;35
|
||||
.iso 1;35
|
||||
.jar 1;35
|
||||
.msi 1;35 # Win
|
||||
.rar 1;35
|
||||
.rpm 1;35
|
||||
.tar 1;35
|
||||
.tbz 1;35
|
||||
.tbz2 1;35
|
||||
.tgz 1;35
|
||||
.tx 1;35
|
||||
.war 1;35
|
||||
.xpi 1;35
|
||||
.xz 1;35
|
||||
.z 1;35
|
||||
.Z 1;35
|
||||
.zip 1;35
|
||||
|
||||
# For testing
|
||||
.ANSI-30-black 30
|
||||
.ANSI-01;30-brblack 01;30
|
||||
.ANSI-31-red 31
|
||||
.ANSI-01;31-brred 01;31
|
||||
.ANSI-32-green 32
|
||||
.ANSI-01;32-brgreen 01;32
|
||||
.ANSI-33-yellow 33
|
||||
.ANSI-01;33-bryellow 01;33
|
||||
.ANSI-34-blue 34
|
||||
.ANSI-01;34-brblue 01;34
|
||||
.ANSI-35-magenta 35
|
||||
.ANSI-01;35-brmagenta 01;35
|
||||
.ANSI-36-cyan 36
|
||||
.ANSI-01;36-brcyan 01;36
|
||||
.ANSI-37-white 37
|
||||
.ANSI-01;37-brwhite 01;37
|
||||
|
||||
#############################################################################
|
||||
# Your customizations
|
||||
|
||||
# Unimportant text files
|
||||
# For universal scheme, use brightgreen 01;32
|
||||
# For optimal on light bg (but too prominent on dark bg), use white 01;34
|
||||
.log 01;32
|
||||
*~ 01;32
|
||||
*# 01;32
|
||||
#.log 01;34
|
||||
#*~ 01;34
|
||||
#*# 01;34
|
||||
|
||||
# Unimportant non-text files
|
||||
# For universal scheme, use brightcyan 01;36
|
||||
# For optimal on dark bg (but too prominent on light bg), change to 01;33
|
||||
#.bak 01;36
|
||||
#.BAK 01;36
|
||||
#.old 01;36
|
||||
#.OLD 01;36
|
||||
#.org_archive 01;36
|
||||
#.off 01;36
|
||||
#.OFF 01;36
|
||||
#.dist 01;36
|
||||
#.DIST 01;36
|
||||
#.orig 01;36
|
||||
#.ORIG 01;36
|
||||
#.swp 01;36
|
||||
#.swo 01;36
|
||||
#*,v 01;36
|
||||
.bak 01;33
|
||||
.BAK 01;33
|
||||
.old 01;33
|
||||
.OLD 01;33
|
||||
.org_archive 01;33
|
||||
.off 01;33
|
||||
.OFF 01;33
|
||||
.dist 01;33
|
||||
.DIST 01;33
|
||||
.orig 01;33
|
||||
.ORIG 01;33
|
||||
.swp 01;33
|
||||
.swo 01;33
|
||||
*,v 01;33
|
||||
|
||||
# The brightmagenta (Solarized: purple) color is free for you to use for your
|
||||
# custom file type
|
||||
.gpg 34
|
||||
.gpg 34
|
||||
.pgp 34
|
||||
.asc 34
|
||||
.3des 34
|
||||
.aes 34
|
||||
.enc 34
|
||||
.sqlite 34
|
||||
35
systemscripts/terminal-logs.sh
Normal file
35
systemscripts/terminal-logs.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
disablefile=$(realpath ~/.notermlogs)
|
||||
if [[ -f "${disablefile}" ]] ; then
|
||||
echo "${disablefile} exists > Terminal - Logging is disabled"
|
||||
else
|
||||
if [[ -z "${termlogpid}" ]] ; then
|
||||
export termlogpid="$(echo $$)"
|
||||
export termlogsdir="${HOME}/termlogs"
|
||||
export termlogfilename="${termlogsdir}/$(date +%Y-%m-%d_%H:%M:%S)_${termlogpid}"
|
||||
if ! [[ -d "${termlogsdir}" ]] ; then
|
||||
echo "Terminal log folder does not exist. ${termlogsdir} will be created..."
|
||||
mkdir -v -p "${termlogsdir}"
|
||||
fi
|
||||
#Cleanup old files
|
||||
echo "Removin Terminal Logs older than 30 days:"
|
||||
find "${termlogsdir}" -type f -mtime +30
|
||||
find "${termlogsdir}" -type f -mtime +30 -delete
|
||||
|
||||
#prepare outputfiles with proper permissions
|
||||
touch "${termlogfilename}.termlog"
|
||||
chmod 600 "${termlogfilename}.termlog"
|
||||
touch "${termlogfilename}.termtime"
|
||||
chmod 600 "${termlogfilename}.termtime"
|
||||
#start logged session
|
||||
script -t"${termlogfilename}.termtime" "${termlogfilename}.termlog"
|
||||
#clean up after exiting
|
||||
gzip "${termlogfilename}.termlog"
|
||||
if [[ -f "/tmp/disablescreenrecord_${termlogpid}" ]] ; then
|
||||
echo "Recording stopped for this session"
|
||||
else
|
||||
exit
|
||||
fi
|
||||
else
|
||||
alias stop_termlog="touch /tmp/disablescreenrecord_${termlogpid} ; exit"
|
||||
fi
|
||||
fi
|
||||
3
systemscripts/toggle_display.sh
Executable file
3
systemscripts/toggle_display.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
display=$(xrandr | grep -wi connected | grep -i hdmi | cut -f1 -d" ")
|
||||
xrandr --output ${display} --primary
|
||||
8
systemscripts/toggle_touchpad
Executable file
8
systemscripts/toggle_touchpad
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
touchpad_id=$(xinput list | grep -i -e touch -e Synaptics | grep -Po '(?<=id=)\d+')
|
||||
echo $touchpad_id
|
||||
if (xinput list-props ${touchpad_id} | grep "Device Enabled" | grep -Po '\d$' | grep -q "1"); then
|
||||
xinput disable "${touchpad_id}"
|
||||
else
|
||||
xinput enable "${touchpad_id}"
|
||||
fi
|
||||
Reference in New Issue
Block a user