From 7bc6d729f7ce47d379a935d6bc14d73090450baa Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Fri, 31 Mar 2017 13:54:00 +0200 Subject: [PATCH] Initial import --- .bash_logout | 3 ++ .bash_profile | 5 ++++ .bashrc | 12 ++++++++ .config/htop/htoprc | 26 ++++++++++++++++ .toprc | 15 ++++++++++ .vimrc | 29 ++++++++++++++++++ bin/arch-update | 4 +++ bin/music-pull-from-storage | 2 ++ bin/music-push-to-server | 2 ++ bin/music-push-to-storage | 2 ++ bin/ocp | 18 ++++++++++++ bin/rwget | 54 ++++++++++++++++++++++++++++++++++ bin/share | 9 ++++++ sbin/install-grub.sh | 17 +++++++++++ sbin/pacman-disowned | 15 ++++++++++ sbin/pacman-orphaned-files | 15 ++++++++++ sbin/pacman-refresh-mirrorlist | 5 ++++ sbin/shutdown-array.sh | 5 ++++ 18 files changed, 238 insertions(+) create mode 100644 .bash_logout create mode 100644 .bash_profile create mode 100644 .bashrc create mode 100644 .config/htop/htoprc create mode 100644 .toprc create mode 100644 .vimrc create mode 100755 bin/arch-update create mode 100755 bin/music-pull-from-storage create mode 100755 bin/music-push-to-server create mode 100755 bin/music-push-to-storage create mode 100755 bin/ocp create mode 100755 bin/rwget create mode 100755 bin/share create mode 100755 sbin/install-grub.sh create mode 100755 sbin/pacman-disowned create mode 100755 sbin/pacman-orphaned-files create mode 100755 sbin/pacman-refresh-mirrorlist create mode 100755 sbin/shutdown-array.sh diff --git a/.bash_logout b/.bash_logout new file mode 100644 index 0000000..0e4e4f1 --- /dev/null +++ b/.bash_logout @@ -0,0 +1,3 @@ +# +# ~/.bash_logout +# diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..5545f00 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,5 @@ +# +# ~/.bash_profile +# + +[[ -f ~/.bashrc ]] && . ~/.bashrc diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..abbc23c --- /dev/null +++ b/.bashrc @@ -0,0 +1,12 @@ +# +# ~/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +alias ls='ls --color=auto' +alias grep='grep --color=auto' +PS1='[\u@\h \W]\$ ' + +export PATH=$PATH:/home/jpt/bin diff --git a/.config/htop/htoprc b/.config/htop/htoprc new file mode 100644 index 0000000..6e1897e --- /dev/null +++ b/.config/htop/htoprc @@ -0,0 +1,26 @@ +# Beware! This file is rewritten by htop when settings are changed in the interface. +# The parser is also very primitive, and not human-friendly. +fields=0 48 17 18 38 39 40 2 46 47 49 1 +sort_key=46 +sort_direction=1 +hide_threads=0 +hide_kernel_threads=0 +hide_userland_threads=0 +shadow_other_users=1 +show_thread_names=1 +show_program_path=1 +highlight_base_name=1 +highlight_megabytes=1 +highlight_threads=1 +tree_view=1 +header_margin=1 +detailed_cpu_time=1 +cpu_count_from_zero=0 +update_process_names=0 +account_guest_in_cpu_meter=1 +color_scheme=0 +delay=15 +left_meters=LeftCPUs Memory Swap +left_meter_modes=1 1 1 +right_meters=RightCPUs Tasks LoadAverage Uptime +right_meter_modes=1 2 2 2 diff --git a/.toprc b/.toprc new file mode 100644 index 0000000..8dc22b3 --- /dev/null +++ b/.toprc @@ -0,0 +1,15 @@ +top's Config File (Linux processes with windows) +Id:i, Mode_altscr=0, Mode_irixps=1, Delay_time=0.500, Curwin=3 +Def fieldscur=¥&K¨³´»½@·º¹56ÄFÅ')*+,-./0128<>?ABCGHIJLMNOPQRSTUVWXYZ[\]^_`abcdefghij + winflags=162740, sortindx=21, maxtasks=0, graph_cpus=1, graph_mems=2 + summclr=1, msgsclr=1, headclr=3, taskclr=1 +Job fieldscur=¥¦¹·º(³´Ä»½@<§Å)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij + winflags=163124, sortindx=0, maxtasks=0, graph_cpus=2, graph_mems=0 + summclr=6, msgsclr=6, headclr=7, taskclr=6 +Mem fieldscur=¥º»<½¾¿ÀÁMBNÃD34·Å&'()*+,-./0125689FGHIJKLOPQRSTUVWXYZ[\]^_`abcdefghij + winflags=163124, sortindx=21, maxtasks=0, graph_cpus=2, graph_mems=0 + summclr=5, msgsclr=5, headclr=4, taskclr=5 +Usr fieldscur=¥¦§¨ª°¹·ºÄÅ)+,-./1234568;<=>?@ABCFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij + winflags=162740, sortindx=11, maxtasks=0, graph_cpus=2, graph_mems=0 + summclr=3, msgsclr=3, headclr=2, taskclr=3 +Fixed_widest=0, Summ_mscale=2, Task_mscale=1, Zero_suppress=0 diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..6d21637 --- /dev/null +++ b/.vimrc @@ -0,0 +1,29 @@ +" enable syntax highlighting +syntax enable + +" dark background +set background=dark + +" show line numbers +set number + +" set tabs to have 4 spaces +set ts=4 + +" indent when moving to the next line while writing code +set autoindent + +" expand tabs into spaces +set expandtab + +" when using the >> or << commands, shift lines by 4 spaces +set shiftwidth=4 + +" show a visual line under the cursor's current line +set cursorline + +" show the matching part of the pair for [] {} and () +set showmatch + +" enable all Python syntax highlighting features +let python_highlight_all = 1 diff --git a/bin/arch-update b/bin/arch-update new file mode 100755 index 0000000..18c8ba3 --- /dev/null +++ b/bin/arch-update @@ -0,0 +1,4 @@ +#!/bin/bash +sudo pacman -Syu --noconfirm +pacaur -Syau --noconfirm --noedit +sudo pacman -Syu --noconfirm diff --git a/bin/music-pull-from-storage b/bin/music-pull-from-storage new file mode 100755 index 0000000..51a87dc --- /dev/null +++ b/bin/music-pull-from-storage @@ -0,0 +1,2 @@ +#!/bin/bash +rsync --recursive --times --update --delete-after --force --progress rsync://192.168.0.106/music /media/Daten/Media/Musik/ diff --git a/bin/music-push-to-server b/bin/music-push-to-server new file mode 100755 index 0000000..4fcbaef --- /dev/null +++ b/bin/music-push-to-server @@ -0,0 +1,2 @@ +#!/bin/bash +rsync --recursive --times --update --delete-after --force --progress /media/Daten/Media/Musik/ jpt@backup.jpt.lu:/home/jpt/Music/ diff --git a/bin/music-push-to-storage b/bin/music-push-to-storage new file mode 100755 index 0000000..45217bc --- /dev/null +++ b/bin/music-push-to-storage @@ -0,0 +1,2 @@ +#!/bin/bash +rsync --recursive --times --update --delete-after --force --progress /media/Daten/Media/Musik/ rsync://192.168.0.106/music diff --git a/bin/ocp b/bin/ocp new file mode 100755 index 0000000..f5ce67d --- /dev/null +++ b/bin/ocp @@ -0,0 +1,18 @@ +#!/bin/bash + +USAGE="Usage: $0 target file1 file2 file3 ..." + +if [ "$#" == "0" ]; then + echo "$USAGE" + echo + exit 1 +fi + +TARGET=$1 +shift + +while (( "$#" )); do + echo "Copying '$1' to '$TARGET'." + rsync --inplace --recursive --progress "$1" "$TARGET" + shift +done diff --git a/bin/rwget b/bin/rwget new file mode 100755 index 0000000..f495f00 --- /dev/null +++ b/bin/rwget @@ -0,0 +1,54 @@ +#!/bin/bash + +# Base wget command +BASE_CMD="wget -r -c --no-host-directories --no-parent --reject='index.html*'" + +# Let's get the URL first +if [ "$1" == "" ]; then + echo "No url given!" >&2 + exit 1 +else + PARAM_URL="'$1'" + shift +fi + +# Collect non-essential parameters and build the final command to run +FINAL_CMD="$BASE_CMD" + +# Collect rate limit +if [ "$1" != "" ]; then + PARAM_LIMIT="--limit-rate='$1'" + FINAL_CMD="$FINAL_CMD $PARAM_LIMIT" +fi +shift + +# Collect user + pass, error out if one is missing +if [ "$1" != "" ]; then + PARAM_USER="--user='$1'" + shift + # Collect password, too + if [ "$1" == "" ] ; then + echo "User given, but password missing?!" >&2 + exit 1 + else + PARAM_PASS="--password='$1'" + fi + FINAL_CMD="$FINAL_CMD $PARAM_USER $PARAM_PASS" +fi +shift + +# Append URL and that's it. +FINAL_CMD="$FINAL_CMD $PARAM_URL" + +# Debug output +echo "-------------------------------------" +echo "PARAM_LIMIT: $PARAM_LIMIT" +echo "PARAM_USER: $PARAM_USER" +echo "PARAM_PASS: $PARAM_PASS" +echo "PARAM_URL: $PARAM_URL" +echo "-------------------------------------" +echo "Running command: $FINAL_CMD" +echo "-------------------------------------" +echo "" +eval $FINAL_CMD + diff --git a/bin/share b/bin/share new file mode 100755 index 0000000..c4532fb --- /dev/null +++ b/bin/share @@ -0,0 +1,9 @@ +#!/bin/bash +FILE=$1 +if [ "$FILE" = "" ]; then + echo "Usage: $0 " >&2 + exit 1 +else + curl -F "file=@$FILE" https://x0.at/ +fi +echo "" diff --git a/sbin/install-grub.sh b/sbin/install-grub.sh new file mode 100755 index 0000000..3bfd06e --- /dev/null +++ b/sbin/install-grub.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -x + +# load settings from config file +. /etc/default/grub + +# create config +grub-mkconfig -o /boot/grub/grub.cfg + +# install on ssd and hdd +#grub-install --modules="$GRUB_PRELOAD_MODULES" /dev/sda +grub-install --modules="$GRUB_PRELOAD_MODULES" /dev/sdb + +# sync and that's it +sync + diff --git a/sbin/pacman-disowned b/sbin/pacman-disowned new file mode 100755 index 0000000..0ccabf0 --- /dev/null +++ b/sbin/pacman-disowned @@ -0,0 +1,15 @@ +#!/bin/sh + +tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ +db=$tmp/db +fs=$tmp/fs + +mkdir "$tmp" +trap 'rm -rf "$tmp"' EXIT + +pacman -Qlq | sort -u > "$db" + +find /etc /opt /usr ! -name lost+found \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + +comm -23 "$fs" "$db" + diff --git a/sbin/pacman-orphaned-files b/sbin/pacman-orphaned-files new file mode 100755 index 0000000..10e9e17 --- /dev/null +++ b/sbin/pacman-orphaned-files @@ -0,0 +1,15 @@ +#!/bin/sh + +tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ +db=$tmp/db +fs=$tmp/fs + +mkdir "$tmp" + +pacman -Qlq | sort -u > "$db" + +find /bin /etc /lib /sbin /usr \ + ! -name lost+found \ + \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + +comm -23 "$fs" "$db" diff --git a/sbin/pacman-refresh-mirrorlist b/sbin/pacman-refresh-mirrorlist new file mode 100755 index 0000000..e1c6a79 --- /dev/null +++ b/sbin/pacman-refresh-mirrorlist @@ -0,0 +1,5 @@ +#!/bin/bash +Cnt="Germany"; +awk -v GG=$Cnt '{if(match($0,GG) != "0")AA="1";if(AA == "1"){if( length($2) != "0" )print substr($0,2) ;else AA="0"} }' /etc/pacman.d/mirrorlist.pacnew > /etc/pacman.d/mirrorlist.germany +rankmirrors -n 6 /etc/pacman.d/mirrorlist.germany > /etc/pacman.d/mirrorlist +rm /etc/pacman.d/mirrorlist.germany diff --git a/sbin/shutdown-array.sh b/sbin/shutdown-array.sh new file mode 100755 index 0000000..21f1e74 --- /dev/null +++ b/sbin/shutdown-array.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +hdparm -y /dev/sdc +hdparm -y /dev/sdd +