From 0ae48a8ac6b21a3fd568ed55e4e912ac1e300ca8 Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Mon, 3 Aug 2020 13:51:11 +0200 Subject: :sparkles: added some small scripts and updated from powerlevel9k to 10k --- bin/batch-img-rename | 27 +++++++++++++++++++++++++++ bin/jsonGen | 32 ++++++++++++++++++++++++++++++++ mac/zshrc | 52 ++++++++++++---------------------------------------- 3 files changed, 71 insertions(+), 40 deletions(-) create mode 100755 bin/batch-img-rename create mode 100755 bin/jsonGen diff --git a/bin/batch-img-rename b/bin/batch-img-rename new file mode 100755 index 0000000..23f486a --- /dev/null +++ b/bin/batch-img-rename @@ -0,0 +1,27 @@ +#!/bin/bash + +echo "usage: rename outputDirectory" + +for file in $1; do + filename=$(basename -- "$file") + extension="${filename##*.}" + + if [ "$extension" == "$2" ]; then + #if [[ $(file -b "$file") =~ "$2" ]]; then + #echo "Changing '$file'." + NEWNAME="$3/$(sips -g creation "$file" | awk '/creation:/{print $3}' | tr ":" "-")" + NEWFILE="$NEWNAME.$2" + i=2 + while [ -f "$NEWFILE" ]; do + NEWFILE="$NEWNAME""_$i.$2" + i=$((i+1)) + done + + echo "- '$file' -> '$NEWFILE'." + cp -p "$file" "$NEWFILE" + continue + fi + echo "Skipping '$file'." + + +done diff --git a/bin/jsonGen b/bin/jsonGen new file mode 100755 index 0000000..3e2d13f --- /dev/null +++ b/bin/jsonGen @@ -0,0 +1,32 @@ +#!/bin/bash + +echo "usage: jsonGen " + +echo "[" > "content.json" + +for file in $1; do + filename=$(basename -- "$file") + extension="${filename##*.}" + originalFile="$2$(echo "$filename" | cut -d "." -f 1).$3" + + echo " {" >> "content.json" + #if [ -f "$originalFile" ]; then + COORDS=$(exiftool -c "%.6f" "$originalFile" | grep "GPS" | grep Position | cut -d ':' -f 2) + NORTH=$(echo "$COORDS" | cut -d "," -f 1 | tr "N" "" | tr " " "") + EAST=$(echo "$COORDS" | cut -d "," -f 2 | tr "E" "" | tr " " "") + echo " \"fileName\": \"$filename\"," >> "content.json" + echo " \"time\": \"2020-07-23T$(echo "$filename" | cut -d "." -f 1 | tr "-" ":") UTC+2\"" >> "content.json" + + echo "FILE: '$filename', NORTH: '$NORTH', EAST: '$EAST'" + # if [ -z "$COORDS" ]; then + #echo "FILE: '$filename', NORTH: '$NORTH', EAST: '$EAST'" + + # fi + + #fi + echo " }," >> "content.json" + + echo "Not in library: '$filename'." +done + +echo "]" >> "content.json" diff --git a/mac/zshrc b/mac/zshrc index 9d54f58..63aa4c2 100644 --- a/mac/zshrc +++ b/mac/zshrc @@ -1,3 +1,10 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + # If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH @@ -8,7 +15,7 @@ fi source /usr/local/etc/zsh_env_setup -source /usr/local/opt/powerlevel9k/powerlevel9k.zsh-theme +source /usr/local/opt/powerlevel10k/powerlevel10k.zsh-theme COMPLETION_WAITING_DOTS="true" @@ -20,45 +27,6 @@ plugins=( source $ZSH/oh-my-zsh.sh -# User configuration - -# You may need to manually set your language environment -# export LANG=en_US.UTF-8 - -# POWERLINE9K -POWERLEVEL9K_MODE="nerdfont-complete" - -POWERLINE9K_PROMPT_ADD_NEWLINE=true - -POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir vcs) -POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs) - -POWERLEVEL9K_SHORTEN_STRATERGY="truncate_to_last" -POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 -POWERLEVEL9K_DIR_SHOW_WRITABLE=true - -# Powerline color config -POWERLEVEL9K_STATUS_OK_BACKGROUND='004' -POWERLEVEL9K_STATUS_OK_FOREGROUND='015' -POWERLEVEL9K_STATUS_ERROR_BACKGROUND='001' -POWERLEVEL9K_STATUS_ERROR_FOREGROUND='015' - -# Powerline icon config -POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\UE0B8' -POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\UE0BE' - -POWERLEVEL9K_HOME_ICON='\UF7DB' -POWERLEVEL9K_HOME_SUB_ICON='\UF07C' -POWERLEVEL9K_FOLDER_ICON='\UF07B' -POWERLEVEL9K_ETC_ICON='\UE5FC' -POWERLEVEL9K_LOCK_ICON='\UF023' - -POWERLEVEL9K_VCS_UNSTAGED_ICON='\UF421' -POWERLEVEL9K_VCS_STAGED='\UF055' -POWERLEVEL9K_VCS_UNTRACKED_ICON='\UF059' -POWERLEVEL9K_VCS_BRANCH_ICON='\UE725 ' - - export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 path+=("/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands") @@ -89,6 +57,10 @@ man() { #clear +# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh + #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! export SDKMAN_DIR="/Users/jakobstendahl/.sdkman" [[ -s "/Users/jakobstendahl/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/jakobstendahl/.sdkman/bin/sdkman-init.sh" + -- cgit v1.2.3