Skip to content

Instantly share code, notes, and snippets.

View andrew-rietz's full-sized avatar

andrew-rietz

  • Boulder, CO
View GitHub Profile
@andrew-rietz
andrew-rietz / Set-Up-PowerShell-for-Python.md
Last active October 10, 2022 17:01
Set Up PowerShell for Python

1. Install Scoop
Scoop is a command-line installer for Windows -- it's like Homebrew for Windows. It installs programs from the command line with a minimal amount of friction. More info about scoop is available here: https://gist.github.com/andrew-rietz/66e4ebcf96f85b6618b078ebe00104b1
To install, open PowerShell and execute the following command:

iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

2. Use Scoop to install some awesome helper applications
We'll use Scoop to install a couple applications: posh-git and starship. Posh-git adds a lot of the convenience features you get in git bash directly into PowerShell (autocompletion, etc.). We'll also install starship.rs: a customizeable prompt for many of the common shells (Bash, Fish, Zsh, PowerShell).

Setup

  1. Install posh-git. Using scoop:
    scoop bucket add extras
    scoop install posh-git
    
  2. Add posh-git to your current terminal session:
    Import-Module posh-git
    

Overview

Scoop is a command-line installer for Windows. Scoop installs programs from the command line with a minimal amount of friction.

Installation

Install scoop: iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

Basic Commands

Install a program: scoop install <<program>>
Check for outdated programs: scoop status

Customizing Your Powershell

Create a Powershell Profile

  1. Check if a profile already exists:
    Test-Path $profile
  2. If the result was 'False' then you don't have a profile yet. Create one:
    New-Item -path $profile -type file –force
    Reference: https://www.howtogeek.com/50236/customizing-your-powershell-profile/

Change the Default Background Color

Adding kernel to jupyter with venv (or to root python directory)

Substitute your desired kernel name for <<project-name>>

pip install ipykernel
ipython kernel install --user --name=<<project-name>>

Adding kernel to jupyter with pipenv

Substitute your desired kernel name for &lt;&gt;

Example Pipenv Workflow

Clone / create project repository:
$ cd myproject

Install from Pipfile, if there is one:
$ pipenv install

Or, add a package to your new project:
$ pipenv install <package>

@andrew-rietz
andrew-rietz / DjangoSetup.md
Last active April 24, 2019 05:59
Django Project Setup
Optional:

A. Set up a virtual environment to house your projects dependencies

$ virtualenv <<venv_name>>
$ source <<venv_name>>/bin/activate

B. Install Django

@andrew-rietz
andrew-rietz / Python and Django - Protect Your Secrets.md
Last active April 17, 2019 15:16
Info on practices to protect your secret info when hosting projects on GitHub

Python and Django - Protect Your Secrets


Credit Alex Van Liew. Original post: https://stackoverflow.com/a/31884002

  1. Create a non-versioned file. Add a new file to your project directory (i.e., secrets.py), reference that file from your setting files, and add the 'secrets' file to your .gitignore list.

  2. Use environment variables. Pass environment variables to your process and then retrieve them with your settins file.

@andrew-rietz
andrew-rietz / Python3 Virtualenv Setup.md
Created April 15, 2019 05:11 — forked from pandafulmanda/Python3 Virtualenv Setup.md
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3