Skip to content

Instantly share code, notes, and snippets.

Genevieve Buckley GenevieveBuckley

  • Monash University
  • Melbourne
View GitHub Profile
@GenevieveBuckley
GenevieveBuckley / settings.json
Last active Mar 25, 2019
Visual Studio Code settings.json config file
View settings.json
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"editor.rulers": [
80
],
"autoDocstring.docstringFormat": "numpy",
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"window.zoomLevel": 0,
"python.formatting.provider": "autopep8",
@GenevieveBuckley
GenevieveBuckley / pytest.ini
Last active Mar 18, 2019
Pytest configuration file
View pytest.ini
[pytest]
addopts = --cov-report xml:cov.xml --cov-report term-missing --cov=mypackagename
@GenevieveBuckley
GenevieveBuckley / user_input.py
Created Mar 15, 2019
User input in python using a while loop
View user_input.py
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
Created Mar 8, 2019
pip install code directly from a github repository
View pip_install_directly_from_github
# pip install code directly from github with:
pip install git+https://github.com/path/to/repo.git
# Note: the repository must include setup.py file to be pip installable.
# Presumably, you can also specify a specific repository branch with:
pip install git+https://github.com/path/to/repo/tree/branchname.git
View markdown-details-collapsible.md

A collapsible section with markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@GenevieveBuckley
GenevieveBuckley / quick_pickle.py
Created Jan 16, 2019
Pickle AdornedImage objects
View quick_pickle.py
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 Nov 19, 2018 — forked from gnarf/..git-pr.md
git pr - Global .gitconfig aliases for Pull Request Managment
View ..git-pr.md

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
View bokeh_jupyter_notebook.py
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 Nov 13, 2018
Python testing and coverage reports with pytest and pytest-cov
View python_testing.md

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 Nov 13, 2018
Checkout a git pull request locally
View checkout_pull_request_locally.md
You can’t perform that action at this time.