Skip to content

Instantly share code, notes, and snippets.

@ricalo
Last active December 2, 2025 21:20
Show Gist options
  • Select an option

  • Save ricalo/245bd396bd2e53d6a559 to your computer and use it in GitHub Desktop.

Select an option

Save ricalo/245bd396bd2e53d6a559 to your computer and use it in GitHub Desktop.
Use git-bash from Android Studio terminal
if [ ! -z "${IDE}" -a "${IDE}" == "AndroidStudio" ]; then
cd $OLDPWD;
fi

I love Git for Windows. It's just easy to move between Linux, Mac and Windows if I use the same tools.

Today I was wondering, how can I use bash from the terminal in Android Studio?

I ran into a blog post that explains how to do the same thing with Cygwin.

Since the Cygwin and git for Windows are similar I decided to give it a shot. Here are the steps:

  1. Create Bash-AndroidStudio.bat included in this gist.

  2. @echo off
    set IDE=AndroidStudio
    "C:\Program Files\Git\bin\bash.exe"
    
  3. Add the following to your .bashrc file

  4. if [ ! -z "${IDE}" -a "${IDE}" == "AndroidStudio" ]; then
        cd $OLDPWD;
    fi
    
  5. In Android Studio, go to settings and add the path to your batch file in Tools > Terminal > Shell path.

Open a new terminal... voila!

@echo off
set IDE=AndroidStudio
"C:\Program Files\Git\bin\bash.exe"
@pfieffer
Copy link

pfieffer commented Mar 4, 2020

Helllo!
where do you create the Bash-AndroidStudio.bat file ? in which directory ?

You can put it anywhere. I put mine in C:\Users\my_user\

@pfieffer
Copy link

pfieffer commented Mar 5, 2020

A caveat to using this is when you open the Terminal you will you have to manually cd into the current working directory

@adesamp
Copy link

adesamp commented Mar 31, 2020

first, why i can't save my changes .bashrc?
second, where should i put the code?

image

@mochadwi
Copy link

first, why i can save my changes .bashrc?

You might want to access/open the git bash windows as administrator, then modify the bash.bashrc
Also don't forget to change this:

@echo off
    set IDE=AndroidStudio
    "go to your actual directory\folder\Git\bin\bash.exe"

second, where should i put the code?

In the last/beginning line of the .bashrc, e.g:

# this is the existing bash scripts
if [ ! -z "${IDE}" -a "${IDE}" == "AndroidStudio" ]; then
    cd $OLDPWD;
fi

@adesamp

@liang799
Copy link

liang799 commented Jan 9, 2022

Why is cd $OLDPWD not executed even though I followed all the steps?

@Kamil1230xd
Copy link

Kamil1230xd commented Dec 2, 2025

#!/usr/bin/env bash
set -euo pipefail

apply_protection.sh

Automatyczne wgranie AURA Protection Suite do aktualnego repo.

Użycie: ./scripts/apply_protection.sh /ścieżka/do/aura_protection_suite_v2.zip

Jeśli nie podasz ścieżki do zip, skrypt szuka ./aura_protection_suite_v2.zip

ZIP_PATH="${1:-./aura_protection_suite_v2.zip}"
BRANCH="protection/aura-suite-v1-$(date -u +%Y%m%dT%H%M%SZ)"
TMP_DIR="$(mktemp -d)"
GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-$(git config user.name || echo 'aura-bot')}"
GIT_AUTHOR_EMAIL="${GIT_AUTHOR_EMAIL:-$(git config user.email || echo 'dev@aura-idtoken.org')}"
SIGN_COMMITS="${SIGN_COMMITS:-true}" # jeśli chcesz, ustaw na false

echo ">>> AURA Protection apply script"
echo ">>> ZIP: ${ZIP_PATH}"
echo ">>> BRANCH: ${BRANCH}"
echo

if [ ! -f "${ZIP_PATH}" ]; then
echo "ERROR: ZIP not found at ${ZIP_PATH}"
exit 1
fi

1) extract zip to tmp

echo ">>> extracting zip to ${TMP_DIR}"
unzip -oq "${ZIP_PATH}" -d "${TMP_DIR}"

2) create branch

git fetch origin --prune || true
git checkout -b "${BRANCH}"

3) copy files into /PROTECTION

TARGET_DIR="PROTECTION"
mkdir -p "${TARGET_DIR}"
echo ">>> copying protection files to ${TARGET_DIR}/"
rsync -a --ignore-existing "${TMP_DIR}/" "${TARGET_DIR}/"

4) add README and PR template if missing

if [ ! -d ".github" ]; then mkdir -p .github; fi
if [ ! -f ".github/PULL_REQUEST_TEMPLATE.md" ]; then
cat > .github/PULL_REQUEST_TEMPLATE.md <<'PRT'

Cel PR

Dodaje AURA Protection Suite v1.0: licencje, specyfikację protokołu, architekturę defensywną, watermarking.

Checklist (wypełnić przed merge)

  • Przejrzałem LICENSE_CORE_BSL.md z prawnikiem
  • Potwierdziłem, że wszystkie pliki nie zawierają tajnych kluczy
  • Zaktualizowano NOTICE.md jeśli wymagane
  • Dodałem kontakt licensing@aura-idtoken.org
    PRT
    git add .github/PULL_REQUEST_TEMPLATE.md
    fi

5) git add/commit

git add "${TARGET_DIR}" .github/PULL_REQUEST_TEMPLATE.md || true

COMMIT_MSG="chore: add AURA Protection Suite v1.0 (composite licenses, spec, defensive architecture)"
if [ "${SIGN_COMMITS}" = "true" ] && git config user.signingkey >/dev/null 2>&1; then
echo ">>> signing commit with GPG"
git -c user.name="${GIT_AUTHOR_NAME}" -c user.email="${GIT_AUTHOR_EMAIL}" commit -m "${COMMIT_MSG}" -S || true
else
git -c user.name="${GIT_AUTHOR_NAME}" -c user.email="${GIT_AUTHOR_EMAIL}" commit -m "${COMMIT_MSG}" || true
fi

6) push

echo ">>> pushing branch to origin"
git push -u origin "${BRANCH}"

7) create PR with gh CLI if present

if command -v gh >/dev/null 2>&1; then
echo ">>> creating PR (using gh)"
gh pr create --title "chore: add AURA Protection Suite v1.0"
--body "This PR adds the AURA Protection Suite v1.0 — composite license set, protocol spec (AIDS1), defensive architecture and watermarking spec. Please review licensing with legal counsel before merge."
--base main --head "${BRANCH}" || echo "gh pr create failed; create PR manually."
else
echo ">>> gh CLI not found — please open PR manually from branch ${BRANCH}"
fi

echo ">>> done. Branch: ${BRANCH}"

@Kamil1230xd
Copy link

unzip aura_protection_suite_v2.zip -d ./PROTECTION_TMP
rsync -a PROTECTION_TMP/ ./PROTECTION/
rm -rf PROTECTION_TMP

@Kamil1230xd
Copy link

chmod +x ./scripts/apply_protection.sh
./scripts/apply_protection.sh ./aura_protection_suite_v2.zip

@Kamil1230xd
Copy link

Kamil1230xd commented Dec 2, 2025

chore: add AURA Protection Suite v1.0

This PR introduces the AURA Protection Suite v1.0 — a defensive, hybrid licensing and IP protection bundle for the Aura-IDToken project. It adds composited license artifacts, the Aura Identity Standard (AIDS1 v1.0), defensive architecture guidance, IP strategy, and a behavioral watermarking spec.

What is included

  • AURA_LICENSE_COMPOSITE.md (summary of hybrid licensing model)
  • LICENSE_CORE_BSL.md (BSL-style protection spec for TrustMath core)
  • LICENSE_API_MIT.md (MIT for public interfaces & SDKs)
  • LICENSE_EMBEDDINGS_POLYFORM.md (policy summary for embeddings)
  • LICENSE_DOCS_CC.md (CC BY 4.0 for documentation)
  • NOTICE.md (summary & contact)
  • AURA_IDENTITY_STANDARD_v1.0.md (JSON schemas & spec)
  • DEFENSIVE_ARCHITECTURE.md (technical controls, SLSA, WASM, attestation)
  • IP_STRATEGY_OVERVIEW.md (business/IP strategy)
  • BEHAVIORAL_WATERMARKING_SPEC_v1.0.md (watermarking & detection)

Why this change

  • Protects the project's unique IP while enabling adoption via open interfaces.
  • Provides a clear legal and operational baseline for enterprise licensing.
  • Deterrence mechanisms against large-platform extraction (watermarking, sealed core, telemetry).
  • Ready-to-review with legal counsel before merge.

Checklist (please complete before merge)

  • Legal review of LICENSE_CORE_BSL.md and LICENSE_EMBEDDINGS_POLYFORM.md completed
  • Confirm no secrets or sensitive data present in any added files
  • Confirm CONTACT/LICENSING email address is valid
  • SLSA L3 build/release plan documented for TrustMath binaries
  • Add CODEOWNERS for PROTECTION/ to ensure legal review before merge

Suggested reviewers

  • @aura/core (technical lead)
  • @aura/legal (legal & compliance)
  • @aura/security (security engineering)

If you need a legal brief (PDF) or PR modifications, request in comments and I will provide them.

@Kamil1230xd
Copy link

Aura Protection Suite — Legal Summary (short)

This document summarizes the legal strategy for the Aura Protection Suite v1.0 and outlines immediate actions required by legal counsel.

Purpose

  • Implement a hybrid licensing scheme: MIT for interfaces, BSL for core, PolyForm-style shield for embeddings, CC-BY for docs.
  • Provide deterrents and enforceability tools against unauthorized commercial use by large platforms.
  • Ensure the project remains grant-friendly and community-adoptable while preserving exclusive commercial options for the core.

Key Legal Tasks (High Priority)

  1. Finalize BSL Text — Engage counsel to draft an enforceable BSL 1.1 license for the TrustMath core. Specify conversion/change date (recommended 36 months).
  2. Draft PolyForm Shield Equivalent — Counsel to adapt or draft a robust 'shield' license for embeddings and vector intelligence assets to prevent large-scale extraction.
  3. Prepare Enforcement Templates — Cease & desist letter templates, DMCA takedown templates, incident response legal playbook.
  4. Confirm Attribution & NOTICE Wording — Validate attribution language and licensing contact details.
  5. Review Watermarking Legality — Counsel to confirm legality and admissibility of watermarking approach in target jurisdictions (EU, US).
  6. Data & Privacy Review (GDPR) — Validate that the standard and storage approach comply with GDPR and data subject rights (time-decay, redaction, redemption mechanisms).
  7. Commercial Licensing Program — Draft standard commercial license agreement and SLA templates for enterprise customers.

Deliverables for Counsel

  • Legalize LICENSE_CORE_BSL.md and LICENSE_EMBEDDINGS_POLYFORM.md.
  • Produce formal license files for repository (with jurisdiction and governing law).
  • Produce a short two-page legal brief (PDF) summarizing the enforcement path and timelines.

Contacts

@Kamil1230xd
Copy link

cat > PR_BODY.md <<'EOF'
(paste PR body block here)
EOF

@Kamil1230xd
Copy link

mkdir -p .github
cat > .github/CODEOWNERS <<'EOF'
(paste CODEOWNERS block here)
EOF

@Kamil1230xd
Copy link

cat > LEGAL_SUMMARY.md <<'EOF'
(paste legal summary block here)
EOF

@Kamil1230xd
Copy link

chmod +x ./scripts/apply_protection.sh
./scripts/apply_protection.sh ./aura_protection_suite_v2.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment