9 changed files with 190 additions and 62 deletions
@ -1,19 +0,0 @@
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash |
||||
|
||||
#Создан: вт 15 окт 2019 11:15:12 |
||||
#Изменён: вт 15 окт 2019 21:31:41 |
||||
|
||||
API="https://api.github.com/repos/" |
||||
|
||||
last_forks() { |
||||
curl -sq "${API}${1}/forks?sort=stargazers&per_page=100" \ |
||||
| jq -r '.[] | "\(.updated_at) \(.full_name)"' 2>&- \ |
||||
| sed "s|^| |; s|T| |; s|Z | https://github.com/|" \ |
||||
| sort -r \ |
||||
| head -n "${2:-15}" |
||||
} |
||||
|
||||
repository="${1?"USAGE $(basename "$0") user/repository ?top?"}" |
||||
|
||||
last_forks "$repository" "$2" |
||||
|
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash |
||||
|
||||
#Создан: чт 14 ноя 2019 14:03:43 |
||||
#Изменён: чт 14 ноя 2019 17:34:38 |
||||
|
||||
# Список псевдонимов git |
||||
|
||||
# |
||||
# Формат: |
||||
# |
||||
# # Комментарий |
||||
# name = function |
||||
# |
||||
# Игнорирование в выводе: |
||||
# |
||||
# # noindex Комментарий |
||||
# или |
||||
# name = function #noindex |
||||
# |
||||
|
||||
green="\033[1;32m" |
||||
rstc="\033[00m" |
||||
|
||||
GITCONFIG=~/.gitconfig |
||||
|
||||
GIT_ALIASES=$(git config --get-regexp 'alias.*' | sed 's/alias.//' | sed 's/ .*//') |
||||
|
||||
while read -r alias; do |
||||
line=$(\grep -n -E "^\s*${alias}\s+" "$GITCONFIG") |
||||
|
||||
number=${line/:*} |
||||
full_alias=${line/*:} |
||||
|
||||
name=$(sed "s/^[[:space:]]*//; s/=.*$//g; ${number}q;d" $GITCONFIG) |
||||
|
||||
commentary=$(sed "s/[[:space:]]*# //; $((--number))q;d" $GITCONFIG) |
||||
|
||||
if [[ ! "$full_alias" =~ "noindex" ]] && [[ ! "$commentary" =~ "noindex" ]]; then |
||||
printf " • ${green}%-15s${rstc}- %s\n" "$name" "$commentary" |
||||
fi |
||||
done <<<"$GIT_ALIASES" |
||||
|
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash |
||||
|
||||
#Создан: вт 15 окт 2019 11:15:12 |
||||
#Изменён: чт 14 ноя 2019 17:35:25 |
||||
|
||||
# Список форков репозитория на github.com, |
||||
# отсортированный на основе времени последних изменений |
||||
|
||||
API="https://api.github.com/repos/" |
||||
|
||||
last_forks() { |
||||
curl -sq "${API}${1}/forks?sort=stargazers&per_page=100" \ |
||||
| jq -r '.[] | "\(.updated_at) \(.full_name)"' 2>&- \ |
||||
| sed "s|^| |; s|T| |; s|Z | https://github.com/|" \ |
||||
| sort -r \ |
||||
| head -n "$2" |
||||
} |
||||
|
||||
if [ -z "$1" ]; then |
||||
repository=$(git url | grep github.com | sed -e 's|^.*github.com/||' | sed 's/.git.*$//') |
||||
else |
||||
repository="$1" |
||||
fi |
||||
|
||||
last_forks "$repository" "${2:-15}" |
||||
|
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash |
||||
|
||||
# Создание графа коммитов git-репозитория |
||||
|
||||
# This produces output that can be displayed using dotty, for example: |
||||
# $ git graphviz HEAD~100..HEAD~60 | dotty /dev/stdin |
||||
# $ git graphviz --first-parent master | dotty /dev/stdin |
||||
# Note how defining a function eliminates the need to use sh -c. |
||||
|
||||
make_graphviz() { |
||||
echo 'digraph git {' |
||||
git log --pretty='format: %h -> { %p }' "$@" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' |
||||
echo '}' |
||||
} |
||||
|
||||
make_graphviz "$@" |
||||
|
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash |
||||
|
||||
# Получение шаблона gitignore с сайта gitignore.io |
||||
|
||||
ROOT=$(git root 2>&-) |
||||
|
||||
TYPES=() |
||||
|
||||
while [[ $# -gt 0 ]]; do |
||||
key="$1" |
||||
|
||||
case $key in |
||||
-w|--write) |
||||
WRITE=1 |
||||
shift |
||||
;; |
||||
*) |
||||
TYPES+=("$1") |
||||
shift |
||||
;; |
||||
esac |
||||
done |
||||
|
||||
set -- "${TYPES[@]}" |
||||
|
||||
if [ "${#TYPES[@]}" -gt 0 ]; then |
||||
for t in "${TYPES[@]}"; do |
||||
if [ -n "$WRITE" ] && [ -n "$ROOT" ]; then |
||||
echo "# $t" |
||||
curl -sq "https://gitignore.io/api/${t}" >> "$(git root)/.gitignore" |
||||
else |
||||
curl -sq "https://gitignore.io/api/${t}" |
||||
fi |
||||
done |
||||
|
||||
if [ -n "$WRITE" ] && [ -n "$ROOT" ]; then |
||||
echo "Ignoring list saved to ${ROOT}/.gitignore file." |
||||
fi |
||||
else |
||||
echo "USAGE: $(basename "$0") [-w/--write] type1 type2 [...]" |
||||
exit 1 |
||||
fi |
||||
|
Loading…
Reference in new issue