Merge branch 'master' of ssh://gitea.tlcnet.info:227/tracey/shell-scripts
This commit is contained in:
commit
e225980b19
13 changed files with 480 additions and 1151 deletions
|
|
@ -1,5 +1,4 @@
|
|||
# ZSH and Bash config files for personal use
|
||||
# ZSH Bash and other config files for personal use
|
||||
# File processing scripts to archive financial files from previous year
|
||||
## TODO
|
||||
- Add .vimrc
|
||||
- Add to .vimrc command to map <F3> such that it can switch between paste and nopaste modes:
|
||||
`set pastetoggle=<F3>`
|
||||
None
|
||||
|
|
@ -2,64 +2,86 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
# Script to archive the financial data from the previous year
|
||||
use Time::Piece;
|
||||
use File::Find::Rule; # find all the subdirectories of a given directory
|
||||
# http://search.cpan.org/~rclamp/File-Find-Rule-0.32/README
|
||||
use File::Path qw(make_path remove_tree);
|
||||
use File::Copy;
|
||||
use File::Basename;
|
||||
use File::Find::Rule;
|
||||
use File::Copy::Recursive qw(dircopy);
|
||||
use File::DirCompare;
|
||||
use Carp qw( croak );
|
||||
|
||||
my $now = localtime;
|
||||
my $year = $now->year;
|
||||
print "Year is $year\n";
|
||||
print "Current year: $year\n";
|
||||
|
||||
# Get year to archive from current year
|
||||
my $lastyear = $now->add_years(-1)->year;
|
||||
my $lasttaxyear = $now->add_years(-2)->year;
|
||||
|
||||
print("Last year was $lastyear and tax year was $lasttaxyear\n");
|
||||
print("Last year: $lastyear\n");
|
||||
|
||||
# Define and create folders
|
||||
my ( $financial_folder, $financial_archive_folder, $lastyear_folder, $lasttaxyear_folder );
|
||||
$financial_folder = '/home/tracey/Documents/financial/current_year/';
|
||||
$financial_archive_folder = '~/Documents/financial/1_financial_archives/';
|
||||
$lastyear_folder = $financial_archive_folder . $lastyear . 'FinancialArchives';
|
||||
$lasttaxyear_folder = $financial_archive_folder . $lasttaxyear . 'TaxArchives';
|
||||
my @folders = ( $financial_folder, $financial_archive_folder, $lastyear_folder, $lasttaxyear_folder );
|
||||
my $financial_folder = '/home/tracey/Documents/financial/current_year/';
|
||||
my $financial_archive_folder =
|
||||
'/home/tracey/Documents/financial/1_financial_archives/';
|
||||
my $lastyear_folder =
|
||||
$financial_archive_folder . $lastyear . 'FinancialArchives';
|
||||
my @folders =
|
||||
( $financial_folder, $financial_archive_folder, $lastyear_folder );
|
||||
|
||||
foreach my $folder ( @folders ) {
|
||||
unless( -d $folder ) {
|
||||
print("Creating the folder \"$folder\"\n");
|
||||
die "Could not create directory! $!" unless make_path($folder);
|
||||
print("Copying current directories to archive folder\n");
|
||||
print("From: $financial_folder\n");
|
||||
print("To: $lastyear_folder\n");
|
||||
dircopy( $financial_folder, $lastyear_folder )
|
||||
or croak "Could not copy directories $!";
|
||||
|
||||
# Make sure contents match before we do any Deleting
|
||||
# croak on errors to guard against data losss
|
||||
my $same_result = compare_dirs( $financial_folder, $lastyear_folder );
|
||||
croak "Error: The folders are not the same!" unless ( $same_result == 1 );
|
||||
|
||||
# Delete all files from current year from archive folders
|
||||
# Also delete files from last year in current year folder
|
||||
delete_dirs( $financial_folder, $lastyear_folder, $year, $lastyear );
|
||||
|
||||
sub compare_dirs {
|
||||
my ( $dir1, $dir2 ) = @_;
|
||||
my $same = 1;
|
||||
print("Making sure the copy was complete and all files match\n");
|
||||
File::DirCompare->compare(
|
||||
$dir1, $dir2,
|
||||
sub {
|
||||
my ( $a, $b ) = @_;
|
||||
if ( !$b ) {
|
||||
printf "Only in %s: %s\n", dirname($a), basename($a);
|
||||
$same = 0;
|
||||
}
|
||||
elsif ( !$a ) {
|
||||
printf "Only in %s: %s\n", dirname($b), basename($b);
|
||||
$same = 0;
|
||||
}
|
||||
else {
|
||||
print "Files $a and $b differ\n";
|
||||
$same = 0;
|
||||
}
|
||||
}
|
||||
);
|
||||
print("Diff of directories done\n");
|
||||
return $same;
|
||||
}
|
||||
|
||||
# Get current folder list for nonempty directories
|
||||
my $find_rule = File::Find::Rule->new;
|
||||
$find_rule->nonempty->maxdepth(1)->mindepth(1)->relative;
|
||||
my @curr_subdirs = $find_rule->directory->in( $financial_folder );
|
||||
sub delete_dirs {
|
||||
my ( $new_dir, $old_dir, $curr_year, $last_year ) = @_;
|
||||
print("Deleting files from current year $curr_year in archives\n");
|
||||
print("and files from last year $last_year from current folder\n");
|
||||
|
||||
print("Copying current directories to archives folder\n");
|
||||
foreach my $curr_subdir (@curr_subdirs) {
|
||||
my $targetdir = $lastyear_folder . "/" . $curr_subdir;
|
||||
print ("Target dir is $targetdir\n");
|
||||
#unless( -d $targetdir ){
|
||||
print("Copying directory \"$curr_subdir\"\n");
|
||||
print("Will copy to " . $targetdir . "/\n");
|
||||
# copy directories to archive directories the perl way
|
||||
#copy( $curr_subdir, $lastyear_folder ) or die "Copy failed: $!";
|
||||
#}
|
||||
my @this_year_files =
|
||||
File::Find::Rule->file()->name("*$curr_year*")->in($old_dir);
|
||||
my @last_year_files =
|
||||
File::Find::Rule->file()->name("*$last_year*")->in($new_dir);
|
||||
|
||||
unlink @this_year_files;
|
||||
print("Deleted all $curr_year files from the folder for $last_year\n");
|
||||
unlink @last_year_files;
|
||||
print("Deleted all $last_year files from the folder for $curr_year\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# compare new directories to old directories to make sure they are the same
|
||||
# Or DIE
|
||||
|
||||
# For each CURR folder
|
||||
# For each file
|
||||
# If mtime year < this year
|
||||
# Delete file
|
||||
|
||||
# For each ARCH folder
|
||||
# For each file
|
||||
# If mtime year > last year
|
||||
# Delete file
|
||||
|
|
|
|||
65
file_processing/archive_taxes.pl
Normal file
65
file_processing/archive_taxes.pl
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Time::Piece;
|
||||
use File::Find::Rule; # find all the subdirectories of a given directory
|
||||
# http://search.cpan.org/~rclamp/File-Find-Rule-0.32/README
|
||||
use File::Path qw(make_path remove_tree);
|
||||
use File::Copy;
|
||||
|
||||
my $now = localtime;
|
||||
my $year = $now->year;
|
||||
print "Year is $year\n";
|
||||
|
||||
# Get year to archive from current year
|
||||
my $lastyear = $now->add_years(-1)->year;
|
||||
my $lasttaxyear = $now->add_years(-2)->year;
|
||||
|
||||
print("Last year was $lastyear and tax year was $lasttaxyear\n");
|
||||
|
||||
# Define and create folders
|
||||
my ( $financial_folder, $financial_archive_folder, $lastyear_folder, $lasttaxyear_folder );
|
||||
$financial_folder = '/home/tracey/Documents/financial/current_year/';
|
||||
$financial_archive_folder = '~/Documents/financial/1_financial_archives/';
|
||||
$lastyear_folder = $financial_archive_folder . $lastyear . 'FinancialArchives';
|
||||
$lasttaxyear_folder = $financial_archive_folder . $lasttaxyear . 'TaxArchives';
|
||||
my @folders = ( $financial_folder, $financial_archive_folder, $lastyear_folder, $lasttaxyear_folder );
|
||||
|
||||
foreach my $folder ( @folders ) {
|
||||
unless( -d $folder ) {
|
||||
print("Creating the folder \"$folder\"\n");
|
||||
die "Could not create directory! $!" unless make_path($folder);
|
||||
}
|
||||
}
|
||||
|
||||
# Get current folder list for nonempty directories
|
||||
my $find_rule = File::Find::Rule->new;
|
||||
$find_rule->nonempty->maxdepth(1)->mindepth(1)->relative;
|
||||
my @curr_subdirs = $find_rule->directory->in( $financial_folder );
|
||||
|
||||
print("Copying current directories to archives folder\n");
|
||||
foreach my $curr_subdir (@curr_subdirs) {
|
||||
my $targetdir = $lastyear_folder . "/" . $curr_subdir;
|
||||
print ("Target dir is $targetdir\n");
|
||||
#unless( -d $targetdir ){
|
||||
print("Copying directory \"$curr_subdir\"\n");
|
||||
print("Will copy to " . $targetdir . "/\n");
|
||||
# copy directories to archive directories the perl way
|
||||
#copy( $curr_subdir, $lastyear_folder ) or die "Copy failed: $!";
|
||||
#}
|
||||
}
|
||||
|
||||
|
||||
# compare new directories to old directories to make sure they are the same
|
||||
# Or DIE
|
||||
|
||||
# For each CURR folder
|
||||
# For each file
|
||||
# If mtime year < this year
|
||||
# Delete file
|
||||
|
||||
# For each ARCH folder
|
||||
# For each file
|
||||
# If mtime year > last year
|
||||
# Delete file
|
||||
|
|
@ -6,4 +6,4 @@ set tabstop=4
|
|||
set shiftwidth=4
|
||||
" On pressing tab, insert 4 spaces
|
||||
set expandtab
|
||||
set pastetoggle=<F3>
|
||||
set pastetoggle=<F3> #To switch between paste and nopaste modes
|
||||
|
|
@ -11,9 +11,9 @@ Host pi3
|
|||
HostName pi3
|
||||
User pi
|
||||
IdentityFile ~/.ssh/tlc_pi3_pi
|
||||
Host gitlab
|
||||
HostName gitlab.tlcnet.info
|
||||
Host gittea
|
||||
HostName gitea.tlcnet.info
|
||||
RSAAuthentication yes
|
||||
# User git
|
||||
Port 227
|
||||
IdentityFile ~/.ssh/tlc_gitlab
|
||||
IdentityFile ~/.ssh/id_tlc_gitea
|
||||
|
|
|
|||
|
|
@ -6,10 +6,9 @@ alias ted='java -jar /home/tracey/bin/ted.jar'
|
|||
alias ll='ls -alFh --group-directories-first'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
alias lad='ls -ldh' # ls directory
|
||||
alias tree='tree -Csu' # nice alternative to 'recursive ls'
|
||||
alias colo='ssh cp'
|
||||
alias colosync='ssh syncthing@cp'
|
||||
alias mountpi='sshfs -o idmap=user pi@pi3:/home/pi /home/tracey/pi3'
|
||||
alias unpi='fusermount -u /home/tracey/pi3'
|
||||
alias less='less -r'
|
||||
alias aptup='sudo zsh -c 'apt update&&apt upgrade&&apt autoremove''
|
||||
alias fixkde='DISPLAY=:0 kwin --replace &'
|
||||
File diff suppressed because it is too large
Load diff
101
home_zsh/.zshrc
101
home_zsh/.zshrc
|
|
@ -1,49 +1,14 @@
|
|||
# Set up the prompt
|
||||
#
|
||||
# Executes commands at the start of an interactive session.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
autoload -Uz promptinit
|
||||
promptinit
|
||||
prompt adam1
|
||||
|
||||
setopt histignorealldups sharehistory
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Keybindings
|
||||
#-------------------------------------------------------------
|
||||
|
||||
bindkey '^H' backward-kill-word
|
||||
bindkey '^F' forward-word
|
||||
bindkey '^B' backward-word
|
||||
# Use emacs keybindings even if our EDITOR is set to vi
|
||||
bindkey -e
|
||||
|
||||
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
|
||||
HISTSIZE=1000
|
||||
SAVEHIST=1000
|
||||
HISTFILE=~/.zsh_history
|
||||
|
||||
# Use modern completion system
|
||||
autoload -U compinit promptinit zcalc zsh-mime-setup
|
||||
compinit
|
||||
promptinit
|
||||
zsh-mime-setup
|
||||
|
||||
zstyle ':completion:*' auto-description 'specify: %d'
|
||||
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
||||
zstyle ':completion:*' format 'Completing %d'
|
||||
zstyle ':completion:*' group-name ''
|
||||
zstyle ':completion:*' menu select=2
|
||||
eval "$(dircolors -b)"
|
||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||
zstyle ':completion:*' list-colors ''
|
||||
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
||||
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
|
||||
zstyle ':completion:*' menu select=long
|
||||
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||
zstyle ':completion:*' use-compctl false
|
||||
zstyle ':completion:*' verbose true
|
||||
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
||||
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
||||
# Source Prezto.
|
||||
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
|
||||
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
||||
fi
|
||||
|
||||
# Load aliases
|
||||
if [ -f ~/.zsh/zshalias ]; then
|
||||
|
|
@ -52,46 +17,12 @@ else
|
|||
print "404: ~/.zsh/zshalias not found."
|
||||
fi
|
||||
|
||||
eval `ssh-agent -s` && ssh-agent
|
||||
ssh-add .ssh/tlc_gitlab
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Prompt bits
|
||||
#-------------------------------------------------------------
|
||||
# Initialize colors.
|
||||
autoload -U colors
|
||||
colors
|
||||
|
||||
# Allow for functions in the prompt.
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
# Autoload zsh functions.
|
||||
fpath=(~/.zsh/functions $fpath)
|
||||
autoload -U ~/.zsh/functions/*(:t)
|
||||
|
||||
# Enable auto-execution of functions.
|
||||
typeset -ga preexec_functions
|
||||
typeset -ga precmd_functions
|
||||
typeset -ga chpwd_functions
|
||||
|
||||
# Append git functions needed for prompt.
|
||||
preexec_functions+='preexec_update_git_vars'
|
||||
precmd_functions+='precmd_update_git_vars'
|
||||
chpwd_functions+='chpwd_update_git_vars'
|
||||
|
||||
# For terminix / tilix
|
||||
if [[ $TERMINIX_ID ]]; then
|
||||
# For tilix vte support
|
||||
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then
|
||||
source /etc/profile.d/vte.sh
|
||||
fi
|
||||
|
||||
# Set the prompt.
|
||||
#PROMPT=$'%{${fg[cyan]}%}%B%~%b$(prompt_git_info)%{${fg[default]}%} '
|
||||
PROMPT=$'%{${fg[magenta]}%}%n%{$reset_color%}\@%{$fg[blue]%}%m%{$reset_color%} %{${fg[cyan]}%}%B%~%b$(prompt_git_info)%{${fg[default]}%} %{$fg[blue]%}%%%{$reset_color%} '
|
||||
|
||||
# Export stuff for sshfs over VPN
|
||||
echo "SSH_AGENT_PID=$SSH_AGENT_PID; export SSH_AGENT_PID;" >~/.thestuff
|
||||
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK; export SSH_AUTH_SOCK;" >>~/.thestuff
|
||||
|
||||
#ssh-agent
|
||||
# Export key file to agent keychain
|
||||
keychain --agents ssh --quick --quiet --noask /home/tracey/.ssh/*
|
||||
# Necessary for loading custom prezto theme
|
||||
autoload -Uz promptinit
|
||||
promptinit
|
||||
prompt paradox
|
||||
|
|
|
|||
8
home_zsh/README.md
Normal file
8
home_zsh/README.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# zsh setup
|
||||
|
||||
Copy the zpreztorc here:
|
||||
|
||||
```zsh
|
||||
❯ ll ~/.zpreztorc
|
||||
lrwxrwxrwx 1 tracey tracey 39 May 20 12:01 /home/tracey/.zpreztorc -> /home/tracey/.zprezto/runcoms/zpreztorc
|
||||
```
|
||||
231
home_zsh/zpreztorc
Normal file
231
home_zsh/zpreztorc
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
#
|
||||
# Sets Prezto options.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
|
||||
# Set case-sensitivity for completion, history lookup, etc.
|
||||
# zstyle ':prezto:*:*' case-sensitive 'yes'
|
||||
|
||||
# Color output (auto set to 'no' on dumb terminals).
|
||||
zstyle ':prezto:*:*' color 'yes'
|
||||
|
||||
# Add additional directories to load prezto modules from
|
||||
#zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib
|
||||
|
||||
# Set the Zsh modules to load (man zshmodules).
|
||||
zstyle ':prezto:load' zmodule 'attr' 'stat'
|
||||
|
||||
# Set the Zsh functions to load (man zshcontrib).
|
||||
# zstyle ':prezto:load' zfunction 'zargs' 'zmv'
|
||||
|
||||
# Set the Prezto modules to load (browse modules).
|
||||
# The order matters.
|
||||
zstyle ':prezto:load' pmodule \
|
||||
'environment' \
|
||||
'terminal' \
|
||||
'editor' \
|
||||
'history' \
|
||||
'directory' \
|
||||
'spectrum' \
|
||||
'utility' \
|
||||
'ssh' \
|
||||
'completion' \
|
||||
'git' \
|
||||
'syntax-highlighting' \
|
||||
'history-substring-search' \
|
||||
'prompt'
|
||||
|
||||
#
|
||||
# Autosuggestions
|
||||
#
|
||||
|
||||
# Set the query found color.
|
||||
# zstyle ':prezto:module:autosuggestions:color' found ''
|
||||
|
||||
#
|
||||
# Completions
|
||||
#
|
||||
|
||||
# Set the entries to ignore in static */etc/hosts* for host completion.
|
||||
# zstyle ':prezto:module:completion:*:hosts' etc-host-ignores \
|
||||
# '0.0.0.0' '127.0.0.1'
|
||||
|
||||
#
|
||||
# Editor
|
||||
#
|
||||
|
||||
# Set the key mapping style to 'emacs' or 'vi'.
|
||||
zstyle ':prezto:module:editor' key-bindings 'emacs'
|
||||
|
||||
# Auto convert .... to ../..
|
||||
# zstyle ':prezto:module:editor' dot-expansion 'yes'
|
||||
|
||||
# Allow the zsh prompt context to be shown.
|
||||
#zstyle ':prezto:module:editor' ps-context 'yes'
|
||||
|
||||
#
|
||||
# Git
|
||||
#
|
||||
|
||||
# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'.
|
||||
# zstyle ':prezto:module:git:status:ignore' submodules 'all'
|
||||
|
||||
#
|
||||
# GNU Utility
|
||||
#
|
||||
|
||||
# Set the command prefix on non-GNU systems.
|
||||
# zstyle ':prezto:module:gnu-utility' prefix 'g'
|
||||
|
||||
#
|
||||
# History Substring Search
|
||||
#
|
||||
|
||||
# Set the query found color.
|
||||
# zstyle ':prezto:module:history-substring-search:color' found ''
|
||||
|
||||
# Set the query not found color.
|
||||
# zstyle ':prezto:module:history-substring-search:color' not-found ''
|
||||
|
||||
# Set the search globbing flags.
|
||||
# zstyle ':prezto:module:history-substring-search' globbing-flags ''
|
||||
|
||||
#
|
||||
# macOS
|
||||
#
|
||||
|
||||
# Set the keyword used by `mand` to open man pages in Dash.app
|
||||
# zstyle ':prezto:module:osx:man' dash-keyword 'manpages'
|
||||
|
||||
#
|
||||
# Pacman
|
||||
#
|
||||
|
||||
# Set the Pacman frontend.
|
||||
# zstyle ':prezto:module:pacman' frontend 'yaourt'
|
||||
|
||||
#
|
||||
# Prompt
|
||||
#
|
||||
|
||||
# Set the prompt theme to load.
|
||||
# Setting it to 'random' loads a random theme.
|
||||
# Auto set to 'off' on dumb terminals.
|
||||
zstyle ':prezto:module:prompt' theme 'sorin'
|
||||
|
||||
# Set the working directory prompt display length.
|
||||
# By default, it is set to 'short'. Set it to 'long' (without '~' expansion)
|
||||
# for longer or 'full' (with '~' expansion) for even longer prompt display.
|
||||
# zstyle ':prezto:module:prompt' pwd-length 'short'
|
||||
|
||||
# Set the prompt to display the return code along with an indicator for non-zero
|
||||
# return codes. This is not supported by all prompts.
|
||||
# zstyle ':prezto:module:prompt' show-return-val 'yes'
|
||||
|
||||
#
|
||||
# Python
|
||||
#
|
||||
|
||||
# Auto switch the Python virtualenv on directory change.
|
||||
# zstyle ':prezto:module:python:virtualenv' auto-switch 'yes'
|
||||
|
||||
# Automatically initialize virtualenvwrapper if pre-requisites are met.
|
||||
# zstyle ':prezto:module:python:virtualenv' initialize 'yes'
|
||||
|
||||
#
|
||||
# Ruby
|
||||
#
|
||||
|
||||
# Auto switch the Ruby version on directory change.
|
||||
# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes'
|
||||
|
||||
#
|
||||
# Screen
|
||||
#
|
||||
|
||||
# Auto start a session when Zsh is launched in a local terminal.
|
||||
# zstyle ':prezto:module:screen:auto-start' local 'yes'
|
||||
|
||||
# Auto start a session when Zsh is launched in a SSH connection.
|
||||
# zstyle ':prezto:module:screen:auto-start' remote 'yes'
|
||||
|
||||
#
|
||||
# SSH
|
||||
#
|
||||
|
||||
# Set the SSH identities to load into the agent.
|
||||
# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github'
|
||||
zstyle ':prezto:module:ssh:load' identities 'tlc_gittea' 'tlc_server'
|
||||
echo 'Loaded the identities'
|
||||
echo `ssh-add -l`
|
||||
|
||||
#
|
||||
# Syntax Highlighting
|
||||
#
|
||||
|
||||
# Set syntax highlighters.
|
||||
# By default, only the main highlighter is enabled.
|
||||
# zstyle ':prezto:module:syntax-highlighting' highlighters \
|
||||
# 'main' \
|
||||
# 'brackets' \
|
||||
# 'pattern' \
|
||||
# 'line' \
|
||||
# 'cursor' \
|
||||
# 'root'
|
||||
#
|
||||
# Set syntax highlighting styles.
|
||||
# zstyle ':prezto:module:syntax-highlighting' styles \
|
||||
# 'builtin' 'bg=blue' \
|
||||
# 'command' 'bg=blue' \
|
||||
# 'function' 'bg=blue'
|
||||
#
|
||||
# Set syntax pattern styles.
|
||||
# zstyle ':prezto:module:syntax-highlighting' pattern \
|
||||
# 'rm*-rf*' 'fg=white,bold,bg=red'
|
||||
|
||||
#
|
||||
# Terminal
|
||||
#
|
||||
|
||||
# Auto set the tab and window titles.
|
||||
# zstyle ':prezto:module:terminal' auto-title 'yes'
|
||||
|
||||
# Set the window title format.
|
||||
# zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s'
|
||||
|
||||
# Set the tab title format.
|
||||
# zstyle ':prezto:module:terminal:tab-title' format '%m: %s'
|
||||
|
||||
# Set the terminal multiplexer title format.
|
||||
# zstyle ':prezto:module:terminal:multiplexer-title' format '%s'
|
||||
|
||||
#
|
||||
# Tmux
|
||||
#
|
||||
|
||||
# Auto start a session when Zsh is launched in a local terminal.
|
||||
# zstyle ':prezto:module:tmux:auto-start' local 'yes'
|
||||
|
||||
# Auto start a session when Zsh is launched in a SSH connection.
|
||||
# zstyle ':prezto:module:tmux:auto-start' remote 'yes'
|
||||
|
||||
# Integrate with iTerm2.
|
||||
# zstyle ':prezto:module:tmux:iterm' integrate 'yes'
|
||||
|
||||
# Set the default session name:
|
||||
# zstyle ':prezto:module:tmux:session' name 'YOUR DEFAULT SESSION NAME'
|
||||
|
||||
#
|
||||
# Utility
|
||||
#
|
||||
|
||||
# Enabled safe options. This aliases cp, ln, mv and rm so that they prompt
|
||||
# before deleting or overwriting files. Set to 'no' to disable this safer
|
||||
# behavior.
|
||||
zstyle ':prezto:module:utility' safe-ops 'no'
|
||||
13
home_zsh/zshrc
Normal file
13
home_zsh/zshrc
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
# Executes commands at the start of an interactive session.
|
||||
#
|
||||
# Authors:
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
# Source Prezto.
|
||||
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
|
||||
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
||||
fi
|
||||
|
||||
# Customize to your needs...
|
||||
38
local_backup.sh
Executable file
38
local_backup.sh
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Script to back up /home/tracey to external USB drive
|
||||
#http://www.bobulous.org.uk/misc/rsync-backup.html
|
||||
date=`date +%Y-%m-%d`
|
||||
mount_point='/media/tracey/Backup'
|
||||
log_file='/home/tracey/backuplogs/usb-rsync-backup-'${date}'.txt'
|
||||
|
||||
echo "#####"
|
||||
echo ""
|
||||
# Check whether target volume is mounted, and mount it if not.
|
||||
if ! mountpoint -q ${mount_point}/; then
|
||||
echo "Mounting the external USB drive."
|
||||
echo "Mountpoint is ${mount_point}"
|
||||
if ! mount ${mount_point}; then
|
||||
echo "An error code was returned by mount command!"
|
||||
exit 5
|
||||
else echo "Mounted successfully.";
|
||||
fi
|
||||
else echo "${mount_point} is already mounted.";
|
||||
fi
|
||||
# Target volume **must** be mounted by this point. If not, die screaming.
|
||||
if ! mountpoint -q ${mount_point}/; then
|
||||
echo "Mounting failed! Cannot run backup without backup volume!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Preparing to transfer differences in home directory to backup USB drive using rsync."
|
||||
|
||||
rsync -azh --exclude '.cache' --exclude 'Videos' --exclude 'Nextcloud' --exclude 'Downloads/isos' --exclude 'VirtualBox VMs' --exclude 'Sync' --exclude 'Downloads/torrents' --exclude '.local/share/Steam' --exclude 'Music' --progress /home/tracey/ /media/tracey/Backup/tracey/ 2>&1 | tee $log_file
|
||||
|
||||
echo ""
|
||||
echo "Backup Complete"
|
||||
echo "Log of this backup is in $log_file"
|
||||
echo "Now deleting backup logs over 7 days"
|
||||
echo "####"
|
||||
|
||||
find /home/tracey/backuplogs -iname 'usb-rsync-backup-*' -mtime +7 -type f -delete
|
||||
29
update-gitea.sh
Normal file
29
update-gitea.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
# Update gitea based on version provided
|
||||
|
||||
# Ask for version if not passed in #
|
||||
|
||||
# Download version specified
|
||||
|
||||
# Stop service
|
||||
|
||||
# Backup current gitea mv
|
||||
|
||||
# Build URL ex
|
||||
# https://dl.gitea.io/gitea/1.7.3/gitea-1.7.3-linux-amd64.xz
|
||||
# https://dl.gitea.io/gitea/$version/gitea-$version-linux-amd64.xz
|
||||
|
||||
# GITEA_XZ=gitea-$version-linux-amd64.xz
|
||||
|
||||
# wget
|
||||
|
||||
# Unzip downloaded gitea
|
||||
# unxz $GITEA_XZ
|
||||
|
||||
# Change perms unless we run this as user gitea
|
||||
|
||||
# Restart gitea
|
||||
|
||||
# Test
|
||||
|
||||
# Email
|
||||
Loading…
Add table
Add a link
Reference in a new issue