This Hackin Cast will build somewhat on the "Intro to Git" workshop I presented at WWHF 2020, and continue the journey of taking your idea for a cool new project, and moving that forward to actually getting it out in front of the world. You will benefit from either having seen that workshop, or having done any of the many Git tutorials available online (e.g. https://try.github.io/)., We'll pick up from having just learned how to start using Git, and work through how to take that knowledge and starting your own first open source project. We'll start a new project in Python, talk through how to build that project, package it up, build some testing around it, and get it pushed up to GitHub where others in the world can start finding it and making use of it. This Hackin cast is appropriate for attendees of all levels, and no prior knowledge (other than very basic command line and git usage) will be expected.
This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory
under contract DE-AC52-07NA27344. Lawrence Livermore National Security, LLC
Releasing Your First (Python)
Open Source Project to the Masses!
Wild West Hackin’ Cast
2021-01-13 Ian Lee
▪ Part 1: Level setting
— Quick primer on Git (see WWHF workshop for deeper dive)
▪ Part 2: Applying that to existing project
— Small improvements matter!
▪ Part 3: Gitting out on your own
— Starting your own project
Can’t I just have the version in the name?
Common Version Control Tools
Fear of Git
If that doesn't fix it, git.txt contains the
phone number of a friend of mine who
understands git. Just wait through a few
minutes of 'It's really pretty simple, just
think of branches as...' and eventually
you'll learn the commands that will fix
Staged vs not staged vs untracked
Good Commit Messages
Merge branch 'asdfasjkfdlas/alkdjf' into
A Word About Branch Names
Working on a Git repo with a remote
Working with Remotes
Git Flow: Main Branches
Git Flow: Feature Branches
Git Flow: Release Branches
Git Flow: Maintenance Branches
Working with remotes
Working on a Git repo with a remote with upstream changes
Working with Upstream Changes
Let’s Git To It!
Code Hosting Platforms
ood.md and found a link that isn’t rendering
WWHF 2020 ADHD Labs
▪ Reading the documentation, found a bug in the docs
Committing Your Changes In The UI
— Documentation updates?
— Add LICENSE file?
— Add a new exploit?
— Fix a bug in an existing exploit?
— Maybe consider adding some CI testing ?
Let’s Git Out There
▪ There are many choices out there…
▪ Don’t let wizards decry your preferences, just find something that works for you!
▪ For me:
— VS Code (https://code.visualstudio.com/)
• Remote Development Toolkit (https://code.visualstudio.com/docs/remote/remote-overview)
— Windows 10
• WSL 2 (https://docs.microsoft.com/en-us/windows/wsl/install-win10)
— macOS / Linux
• Homebrew (https://brew.sh/)
• ZSH + Oh My Zsh (https://ohmyz.sh/)
• Docker (https://www.docker.com/)
Kickstarting Your Development
▪ Windows 10 + WSL 2 (Ubuntu 20.04) + Docker + VS Code
▪ Spin up a new docker container
— docker run -it –v $PWD:/code python:slim /bin/bash
▪ Connect to it with VS Code + Remote Development
▪ Proof* that there is no Tom-foolery happening that you don’t see!
Kickstarting a Project
▪ python3 -m pip install --user poetry
— Add `$HOME/.local/bin` to your $PATH
▪ poetry new --name awesome
▪ Pull up the docs:
│ └── __init__.py
▪ Make it a git repo (`git init`)
▪ Update “authors”
— “Ian Lee "
▪ Add some dependencies
— poetry add requests
— poetry add –D black flake8
— poetry update
▪ Add a basic command line tool
▪ Let’s add a new Python module
▪ Run `poetry install` to update the
Build and Publish the Package
$ poetry build
Building awesome (0.1.0)
- Building sdist
- Built awesome-0.1.0.tar.gz
- Building wheel
- Built awesome-0.1.0-py3-none-any.whl
▪ $ poetry publish
▪ Publish the Git repo
▪ Add unittests
▪ Add Continuous Integration
▪ Add documentation
— Standalone? Website? README only?
▪ See also Marcello's awesome Pretty Little Python Secrets BHIS Webcasts last year
— Part 1: Installing Python Tools/ Libraries the Right Way
— Part 2: Python Development & Packaging as Beautiful as a Poem
▪ Easy way to start a website
▪ Uses Jekyll (https://jekyllrb.com/)
▪ All on top of Git, Hosted by GitHub
— Becomes https://ianlee1521.com
Build your own website with GitHub Pages
▪ I strongly encourage you to start any code / documentation / note projects with
`git init `
▪ Even if you NEVER intend to share it with anyone, anywhere, ever!
▪ You don’t have to be a “1337 haxor dev” to make a meaningful impact on a project.
Leave things better than you found them.
$ cat git.txt
Ian Lee – @IanLee1521
This document was prepared as an account of work sponsored by an agency of the United States government. Neither
the United States government nor Lawrence Livermore National Security, LLC, nor any of their employees makes any
warranty, expressed or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or
usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe
privately owned rights. Reference herein to any specific commercial product, process, or service by trade name,
trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or
favoring by the United States government or Lawrence Livermore National Security, LLC. The views and opinions of
authors expressed herein do not necessarily state or reflect those of the United States government or Lawrence
Livermore National Security, LLC, and shall not be used for advertising or product endorsement purposes.
▪ Computer Engineer
— 2010 – 2015: Primarily Software Development
• Python, Web, (some) System Administration
— 2016 – Present: Cyber Security
• 2016 – Present: Cyber Assessment Coordinator
– Red team on super computers
• 2018 – Present: Alternate Organization ISSO
— Discord: IanLee1521
▪ “Leave things better than you find them”
Who Am I ?
▪ Git Tutorials
▪ Commandline help
— $ man git
— $ git –help
▪ WWHF October 2020 Workshop
What is version control?