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 characters
| #!/bin/sh | |
| # [ -z "$1" ] || ACCESS_TOKEN="$1" | |
| [ -z "$1" ] || ACCESS_AUTH="$1" | |
| [ -z "$2" ] || REPO_NAME="$2" | |
| # [ -z "$ACCESS_TOKEN" ] && { echo "Token not set" ; exit 1; } | |
| [ -z "$ACCESS_AUTH" ] && { echo "Username[:Password] not set" ; exit 1; } | |
| [ -z "$REPO_NAME" ] && { echo "Repo not set" ; exit 1; } |
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 characters
| #!/bin/bash | |
| # A simple script to backup an organization's GitHub repositories. | |
| GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files | |
| GHBU_ORG=${GHBU_ORG-"tterp"} # the GitHub organization whose repos will be backed up | |
| GHBU_UNAME=${GHBU_UNAME-"dskarataev"} # the username of a GitHub account (to use with the GitHub API) | |
| GHBU_PASSWD=${GHBU_PASSWD-"xc4cv0q0"} # the password for that account | |
| GHBU_GITHOST=${GHBU_GITHOST-"github.com"} # the GitHub hostname (see comments) | |
| GHBU_PRUNE_OLD=${GHBU_PRUNE_OLD-true} # when `true`, old backups will be deleted | |
| GHBU_PRUNE_AFTER_N_DAYS=${GHBU_PRUNE_AFTER_N_DAYS-3} # the min age (in days) of backup files to delete |
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 characters
| username=$1 | |
| repos=$(curl -s https://api.github.com/users/$username/repos?per_page=1000 | jq -r '.[] | .name + "|" + .clone_url') | |
| for repo in $(echo $repos | tr " " "\n") | |
| do | |
| name=$(echo $repo | cut -d"|" -f1) | |
| clone_url=$(echo $repo | cut -d"|" -f2) | |
| git clone --mirror $clone_url ./$username/$name.git && tar -czvf ./$username/$name.tgz -C ./$username/$name.git . | |
| rm -rf ./$username/$name.git |
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 characters
| #!/bin/sh | |
| GITHUB_TOKEN=${1} | |
| LIST_URL=https://${GITHUB_TOKEN}:@api.github.com/users/vbyndych/gists | |
| SINGLE_URL=https://${GITHUB_TOKEN}:@api.github.com/gists | |
| curl -qs $LIST_URL | grep '"id": "' | sed 's/"id": "\([a-z0-9]*\)",/\1/g'| | |
| while read GIST_ID | |
| do | |
| DESCRIPTION=$(curl -qs "$SINGLE_URL/$GIST_ID" | grep '"description": "' | sed 's/"description": "\(.*\)",/\1/g' | tr -d '[:space:]') |
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 characters
| ### GIT ENHANCEMENT START ### | |
| # Git enhancement settings | |
| unset GIT_PS1_SHOWSTASHSTATE | |
| # Git enhancements | |
| source ~/.git-completion.sh | |
| source ~/.git-prompt.sh | |
| # colors! | |
| cyan=$(tput setaf 33) |
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 characters
| #!/bin/bash | |
| # | |
| # This script downloads the specified GitHub repository and installs it in current directory. | |
| set -u -e | |
| # Command-line parameters. | |
| GITHUB_REPO=${1:-Bricks} | |
| GITHUB_USER=${2:-KnowSheet} | |
| GITHUB_BRANCH=${3:-master} |
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 characters
| #!/bin/bash | |
| BACKUP_DIR="/home/justin/backups/git" | |
| cd "$BACKUP_DIR" | |
| for repo_url in `list_my_repos.sh`; do | |
| repo_dir=`echo $repo_url | sed 's/^....//' | tr ':/@' '___'` | |
| git clone --mirror "$repo_url" "/tmp/$repo_dir" > /dev/null 2>&1 | |
| git --git-dir "/tmp/$repo_dir" bundle create "$repo_dir.bundle.new" --all > /dev/null 2>&1 | |
| if [ -f "$repo_dir.bundle" ]; then rm "$repo_dir.bundle"; fi |
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 characters
| USER=username | |
| PASS=password | |
| ACC=account | |
| REPO=repo | |
| # Delete default labels | |
| curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ACC/$REPO/labels/bug" | |
| curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ACC/$REPO/labels/duplicate" | |
| curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ACC/$REPO/labels/enhancement" | |
| curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ACC/$REPO/labels/invalid" |
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 characters
| #!/bin/bash | |
| team="teamname" | |
| org="orgname" | |
| repos=$(hub api orgs/$org/repos --paginate | jq -rc '.[] | select(.archived == false and .disabled == false) | .name') | |
| IFS=$'\n' | |
| for repo in $repos | |
| do | |
| echo "Adding $repo" |
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 characters
| #!/bin/sh | |
| echo -n "GitHub User: " | |
| read USER | |
| echo -n "GitHub Password: " | |
| read -s PASS | |
| echo "" | |
| echo -n "GitHub Repo (e.g. foo/bar): " | |
| read REPO |