dP.  .dP .d8888b. .d8888b. 88d888b. d888888b
 `8bd8'  88'  `"" Y8ooooo. 88'  `88    .d8P'
 .d88b.  88.  ...       88 88        .Y8P   
dP'  `dP `88888P' `88888P' dP       d888888P
    
PROGRAMMER /ˈprōˌɡramər/
A person who solves problems you didn't know you had in ways you don't understand.
public wərk snippets contact

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.
    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`
    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).
    # 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 certificate
    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)
    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