diff --git a/scripts/python/git-switch.py b/scripts/python/git-switch.py new file mode 100755 index 0000000..7bd4477 --- /dev/null +++ b/scripts/python/git-switch.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +import os +import subprocess + +print('Checking git repo...') +url = subprocess.check_output('git remote get-url origin'.split()).decode('utf-8').strip() + +print(f'Current url: {url}') + +if url.startswith('http'): + print('> HTTP git remote detected, switching to SSH') + repo = url.split('github.com/')[-1] + print(f'> Repo detected: {repo}') + new_url = f'git@github.com:{repo}.git' + +elif url.startswith('git@'): + # git@github.com:hykilpikonna/zshrc.git + print('> SSH git remote detected, switching to HTTP') + repo = url.split(':')[-1].split('.git')[0] + print(f'> Repo detected: {repo}') + new_url = f'https://github.com/{repo}' + +else: + print('Failed to detect protocol, exiting') + exit(-1) + +print(f'New URL: {new_url}') +print('> Setting new url...') +os.system(f'git remote set-url origin {new_url}') +print('> Done!') \ No newline at end of file diff --git a/scripts/server/jupy.sh b/scripts/server/jupy.sh new file mode 100644 index 0000000..5bc80d7 --- /dev/null +++ b/scripts/server/jupy.sh @@ -0,0 +1,7 @@ +#!/bin/zsh +/home/azalea/.pyenv/shims/python -m jupyter lab \ + --notebook-dir=/home/azalea/Desktop/Replication \ + --no-browser \ + --ServerApp.password='sha1:c63de8bd7c4a:c1f4a1234608b7032f51277abf7d9da8703d24d6' \ + --ServerApp.port=8349 \ + --ServerApp.allow_origin='*' \ No newline at end of file diff --git a/scripts/zshrc.sh b/scripts/zshrc.sh index 3ea4ebb..702e2ff 100755 --- a/scripts/zshrc.sh +++ b/scripts/zshrc.sh @@ -42,6 +42,8 @@ alias ds-clean="sudo find ./ -name \".DS_Store\" -depth -exec rm {} \;" alias catt="echo 🐱" alias update-ssh-keys="curl -L https://github.com/Hykilpikonna.keys > ~/.ssh/authorized_keys" +export PATH="$SCR/python:$PATH" + # Lisp wrapper lisp() { ros run --load $1 --quit