mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-12-22 07:51:40 +01:00
add extras folder
just miscellaneous script/configs that could be useful
This commit is contained in:
parent
e32676922e
commit
7efeedf6d9
10
extras/automatic_tmux_login.sh
Normal file
10
extras/automatic_tmux_login.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#_tmux_sourced=1 exec tmux
|
||||
if [[ -z $TMUX ]] && [[ -n $SSH_TTY ]]; then
|
||||
session=tmux
|
||||
|
||||
if tmux has-session -t "$session" 2>/dev/null; then
|
||||
exec tmux attach-session -t "$session"
|
||||
else
|
||||
exec tmux new-session -s "$session"
|
||||
fi
|
||||
fi
|
50
extras/sort_timings.zsh
Executable file
50
extras/sort_timings.zsh
Executable file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env zsh
|
||||
# Reads output from zprof.
|
||||
# Usage:
|
||||
# 1. add the following to the beginning of your zshrc
|
||||
# if [[ -n $profiling ]]; then
|
||||
# zmodload zsh/zprof
|
||||
# zmodload zsh/datetime
|
||||
# setopt PROMPT_SUBST
|
||||
# PS4='+$EPOCHREALTIME %N:%i> '
|
||||
#
|
||||
# logfile=$(mktemp zsh_profile.XXXXXXXX)
|
||||
# echo "Logging to $logfile"
|
||||
# exec 3>&2 2>$logfile
|
||||
#
|
||||
# setopt XTRACE
|
||||
# fi
|
||||
# 2. add this to the end of your zshrc
|
||||
# if [[ -n $profiling ]]; then
|
||||
# unsetopt XTRACE
|
||||
# exec 2>&3 3>&-
|
||||
# zprof
|
||||
# fi
|
||||
# 3. zsh -i -c exit
|
||||
# 4. sort_timings.zsh zsh_profile.* # or use the newly-created file
|
||||
|
||||
typeset -a lines
|
||||
typeset -i prev_time=0
|
||||
typeset prev_command
|
||||
|
||||
while read line; do
|
||||
if [[ $line =~ '^.*\+([0-9]{10})\.([0-9]{6})[0-9]* (.+)' ]]; then
|
||||
integer this_time=$match[1]$match[2]
|
||||
|
||||
if [[ $prev_time -gt 0 ]]; then
|
||||
time_difference=$(( $this_time - $prev_time ))
|
||||
lines+="$time_difference $prev_command"
|
||||
fi
|
||||
|
||||
prev_time=$this_time
|
||||
|
||||
local this_command=$match[3]
|
||||
if [[ ${#this_command} -le 80 ]]; then
|
||||
prev_command=$this_command
|
||||
else
|
||||
prev_command="${this_command}..."
|
||||
fi
|
||||
fi
|
||||
done < ${1:-/dev/stdin}
|
||||
|
||||
print -l ${(@On)lines} # | sort -h | vim -
|
4
extras/sshrc
Normal file
4
extras/sshrc
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
if test "$SSH_AUTH_SOCK" ; then
|
||||
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
|
||||
fi
|
15
extras/zprofile
Normal file
15
extras/zprofile
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Make sure SSH_AUTH_sock is symlinked
|
||||
if test "$SSH_AUTH_SOCK" ; then
|
||||
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
|
||||
fi
|
||||
|
||||
#_tmux_sourced=1 exec tmux
|
||||
if [[ -z $TMUX ]] && [[ -n $SSH_TTY ]]; then
|
||||
session=tmux
|
||||
|
||||
if tmux has-session -t "$session" 2>/dev/null; then
|
||||
exec tmux attach-session -t "$session"
|
||||
else
|
||||
exec tmux new-session -s "$session"
|
||||
fi
|
||||
fi
|
18
extras/zprofile_chapek.zsh
Normal file
18
extras/zprofile_chapek.zsh
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
# Make sure SSH_AUTH_sock is symlinked
|
||||
if test "$SSH_AUTH_SOCK" ; then
|
||||
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
|
||||
fi
|
||||
|
||||
#_tmux_sourced=1 exec tmux
|
||||
if [[ -z $TMUX ]] && [[ -n $SSH_TTY ]]; then
|
||||
set -x
|
||||
session=tmux
|
||||
|
||||
if tmux has-session -t "$session" 2>/dev/null; then
|
||||
exec tmux attach-session -t "$session"
|
||||
else
|
||||
tmux new-session -s "$session"
|
||||
exec tmux attach-session -t "$session"
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user