Skip to content

Instantly share code, notes, and snippets.

View GenevieveBuckley's full-sized avatar

Genevieve Buckley GenevieveBuckley

  • Monash University
  • Melbourne
View GitHub Profile
@GenevieveBuckley
GenevieveBuckley / pytest.ini
Last active April 4, 2019 05:01
Pytest configuration file
[pytest]
addopts = --cov-report xml:cov.xml --cov-report term-missing --cov=mypackagename
@GenevieveBuckley
GenevieveBuckley / user_input.py
Created March 15, 2019 00:59
User input in python using a while loop
response_yes = ['yes', 'y']
response_no = ['no', 'n']
response_cancel = ['quit', 'q', 'exit', 'cancel']
known_responses = response_yes + response_no + response_cancel
user_response = ''
while user_response.lower() not in known_responses:
user_response = input("Please input a value, or enter 'quit': ")
print(user_response)
@GenevieveBuckley
GenevieveBuckley / pip_install_directly_from_github
Last active December 17, 2019 00:22
pip install code directly from a github repository
# pip install code directly from github with:
pip install git+https://github.com/path/to/repo
pip install git+https://github.com/path/to/repo.git
# Note: the repository must include setup.py file to be pip installable.
# You can specify a specific repository branch with:
pip install git+https://github.com/path/to/repo@branchname
pip install git+https://github.com/path/to/repo.git@branchname
@GenevieveBuckley
GenevieveBuckley / markdown-details-collapsible.md
Created February 28, 2019 03:14 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section with markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@GenevieveBuckley
GenevieveBuckley / quick_pickle.py
Created January 16, 2019 02:34
Pickle AdornedImage objects
import pickle
from autoscript_sdb_microscope_client import SdbMicroscopeClient
from autoscript_sdb_microscope_client.enumerations import *
from autoscript_sdb_microscope_client.structures import *
microscope = SdbMicroscopeClient()
microscope.connect()
object_to_pickle = microscope.imaging.get_image()
@GenevieveBuckley
GenevieveBuckley / ..git-pr.md
Created November 19, 2018 03:53 — forked from gnarf/..git-pr.md
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@GenevieveBuckley
GenevieveBuckley / bokeh_jupyter_notebook.py
Created November 15, 2018 00:34
bokeh in a jupyter notebook
from bokeh.io import push_notebook, output_notebook, show, save
from bokeh.layouts import row, column, layout
from bokeh.plotting import figure
output_notebook()
@GenevieveBuckley
GenevieveBuckley / python_testing.md
Last active November 13, 2018 04:34
Python testing and coverage reports with pytest and pytest-cov

Python testing

pytest

https://docs.pytest.org/en/latest/usage.html

pytest
pytest path/to/tests/
pytest path/to/tests/test_file.py
pytest path/to/tests/test_file.py::test_func
pytest path/to/tests/test_file.py::TestClass
@GenevieveBuckley
GenevieveBuckley / checkout_pull_request_locally.md
Created November 13, 2018 03:10
Checkout a git pull request locally
@GenevieveBuckley
GenevieveBuckley / .travis.yml
Last active March 14, 2019 23:55
Template for Travis CI integration using conda (remember to replace myenv)
language: python
python:
- "3.5"
- "3.6"
install:
- sudo apt-get update
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r