Skip to content

Instantly share code, notes, and snippets.

View fieldse's full-sized avatar

Matt fieldse

View GitHub Profile
@fieldse
fieldse / Firefox multiple profile setup steps.md
Last active April 13, 2025 13:57
How to Create a Portable Firefox and Run Multiple Profiles
@fieldse
fieldse / Pytest - Capture print statements in Pytest modules from stdout using capsys parameter
Last active September 14, 2017 04:19
Python pytest + stdout: Capture messages sent to stdout / stderr from your functions with pytest capsys
# test.py
# Print statements to pytest
# Capture messages sent to stdout / stderr from your functions,
# and test the output with a pytest unit test.
# tl;dr - use the capsys parameter in your test arguments
# extract the messages sent to stdout/stderr with capsys.readouterr()
@fieldse
fieldse / grepmatch.md
Created September 4, 2017 17:33
Show lines before and after a matching string with grep

Grep to show the surrounding 2 lines before and after your match

grep 'some string to match' -B 2 -A 2 myfile.txt

To list files that will be installed by a debian package (.deb) which is not currently installed on your system

# Ubuntu 15.04+ 
apt download <packagename>

# Earlier versions of Ubuntu
apt-get --download <package name>
@fieldse
fieldse / List files installed by a Debian or Ubuntu .deb package.md
Last active September 3, 2017 13:48
List files installed by a Debian or Ubuntu .deb package
dpkg -L <package name>

Example:

$ dpkg -L apache2
/.
/usr
/usr/share