Skip to content

Instantly share code, notes, and snippets.

View floer32's full-sized avatar

Michael Floering floer32

  • 17:11 (UTC -07:00)
View GitHub Profile
@floer32
floer32 / docstring_for_tests.py
Last active September 21, 2019 21:12
simple HOWTO docstring to paste at top of test packages/modules, i.e. on teams less familiar with pytest
""" Tests for `foo` package.
uses pytest. pytest resources:
* Docs: https://docs.pytest.org/en/latest/
* Book! https://pragprog.com/book/bopytest/python-testing-with-pytest
also uses `responses`, for mocking HTTP exchanges with `requests` library:
* https://github.com/getsentry/responses
@floer32
floer32 / owasp-risk-rating.html
Created September 20, 2017 15:13 — forked from ErosLever/owasp-risk-rating.html
This is a quick and dirty OWASP Risk Rating Calculator. (demo: https://tinyurl.com/OwaspCalc )
<!-- access this at: https://cdn.rawgit.com/ErosLever/f72bc0750af4d2e75c3a/raw/owasp-risk-rating.html -->
<html><head>
<style>
#main{
width: 1200px;
}
table {
width: 98%;
font-size: small;
text-align: center;
@floer32
floer32 / _preserve_ipython_history_TLDR.diff
Last active April 18, 2019 17:41
preserve ipython history between docker-compose runs (for local/development usage). diff is only approximately two lines
diff --git a/local.yml b/local.yml
index b587373..73684bf 100644
--- a/local.yml
+++ b/local.yml
@@ -3,6 +3,7 @@ version: '2'
volumes:
#...
+ ipython_data_local: {}
services:
@floer32
floer32 / python_test_impact_analysis.md
Last active March 28, 2019 21:40
Note on Python TIA (Test Impact Analysis)

Question:

What could I try for doing Test Impact Analysis for Python projects?

Answer:

There are a few libraries out there you could try. Here are some entrypoints:

@floer32
floer32 / stash_dropped.md
Last active October 9, 2019 23:00 — forked from joseluisq/stash_dropped.md
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits:

git log --graph --oneline --decorate $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

Aligning images

left alignment

This is the code you need to align images to the left:

When life gives you lemons, make hummus
@floer32
floer32 / absolute_path_to_script_directory.sh
Created December 7, 2020 23:24
bash/zsh script - how to get absolute path to itself
export HERE="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# example usage - source a script in same directory. but using absolute path,
# ... which you'd do so that a script can be called from wherever. (not dependent on working directory ($PWD))
. "${HERE}/common.sh"
# ... or of course you could export DIRNAME or whatever you want.
# In scripts I just find "$HERE/node_modules", "$HERE/src" etc to be pretty readable.
@floer32
floer32 / master.vim
Last active February 9, 2021 17:45 — forked from gmccreight/master.vim
Shortened fork of master.vim, which is "a script that gives you a playground for mastering vim." I learned via vim-adventures.com originally (highly recommend!) but this was good too. I removed sections I don't use, because I use vim keybindings inside other editors (and prefer the editors' functionality for anything "fancy")
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@floer32
floer32 / RubyMine - project SDK problem (using asdf).md
Last active March 8, 2021 04:12
How to fix Rubymine having issues finding your Ruby SDK. I hit this when switching from rbenv to asdf.

problem:

Error configuring SDK: [...]. 
Please make sure that [... ruby path, from asdf or otherwise ...] is a valid home path for this SDK type.

solution that worked for me:

  1. close RubyMine