Code Snippets
- With atlassian falling apart and abandoning mercurial (the only reason to use bitbucket unless you're one of those anti-microsoft holdouts) you may find yourself looking to collect all your bitbucket repos to take elsewhere ... like ... github. This script is the first step. This is the first draft, only tested on mac running python 3.7 but should work on any posix.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
from requests import get from os import environ, getcwd, chdir, mkdir, system from json import dumps basedir = getcwd() + '/repos' mkdir(basedir) username=environ['BITBUCKET_USER'] password=environ['BITBUCKET_PASS'] team=environ['BITBUCKET_TEAM'] def grab_repos(repos): for repo in repos: print(">> grabbing >>", repo['slug']) chdir(basedir) if repo['scm'] == 'hg': print("cloning %s via hg" % repo['slug']) system('hg clone ssh://hg@bitbucket.org/%s/%s' % (team, repo['slug'])) elif repo['scm'] == 'git': print("cloning %s via git" % repo['slug']) system('git clone --mirror git@bitbucket.org:%s/%s' % (team, repo['slug'])) else: raise Exception("Unable to handle: " . dumps(repo)) repolist = [] next_page = 'https://api.bitbucket.org/2.0/teams/%s/repositories' % team while next_page != None: print(">> loading repo list from", next_page) results = get(next_page, auth=(username, password)).json() next_page = results.get('next', None) grab_repos(results['values']) - fix for when `macos catalina upgrade` makes random scripts bomb with `Abort trap: 6`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
brew update && brew upgrade && brew install openssl cd /usr/local/Cellar/openssl/1.0.2*/lib sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib/ cd /usr/local/lib sudo ln -s libssl.1.0.0.dylib libssl.dylib sudo ln -s libcrypto.1.0.0.dylib libcrypto.dylib - This one command is so hard to track down every 3 years when I need it. So many posts incorrectly insist the private key is in PEM format already. In truth, it depends on how the key pair was created (openssl vs ssh-keygen).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
# NOTE: this updates the file in place, do you have a backup? ssh-keygen -p -m PEM -f ~/.ssh/id_rsa - Print the dates from an SSL certificateThis 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
openssl x509 -noout -dates -in cert.pem - When you need to jump start a material-ui project with the pre-hooks version of react. (react v16.7, material-ui v3.7.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
curl https://codeload.github.com/mui-org/material-ui/tar.gz/v3.7.1 | tar -xz --strip=2 material-ui-3.7.1/examples/create-react-app