Last active
February 10, 2019 13:57
-
-
Save hhc0null/fbd9ac6bb297e20a58b3af135b672b0a to your computer and use it in GitHub Desktop.
Revisions
-
hhc0null renamed this gist
Feb 10, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
hhc0null created this gist
Feb 10, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ function peco-history-selection() { BUFFER=$(history 1 | sort -k1,1nr | perl -ne 'BEGIN { my @lines = (); } s/^\s*\d+\*?\s*//; $in=$_; if (!(grep {$in eq $_} @lines)) { push(@lines, $in); print $in; }' | peco --query "$LBUFFER") CURSOR=${#BUFFER} zle reset-prompt } zle -N peco-history-selection bindkey -M vicmd "^R" peco-history-selection function select_pid() { initial_query=$( [[ -n "${1}" ]] && print "${1}" || print "") pid=$(ps aux | peco --query "${initial_query}" | awk '{print $2}' ) print -n ${pid} } function att() { module_name=$( [[ -n "${1}" ]] && print "${1}" || print "") sudo gdb -q -x /usr/share/pwndbg/gdbinit.py -p $(select_pid "${module_name}") } function git-pull-each() { local -a pulling_failed_repos for repo in ${@} do builtin cd "${repo}" echo "Git-pull \"${repo}\" from \"$(git remote get-url origin)\"" git pull if [ $? -eq 0 ] then pulling_failed_repos=(${pulling_failed_repos} ${repo}) fi popd > /dev/null done if [ ${#pulling_failed_repos[@]} -eq 0 ] then for repo in ${pulling_failed_repos} do echo "Failed to pull => ${$repo}" done fi }