Skip to content

Instantly share code, notes, and snippets.

View lassebenni's full-sized avatar

Lasse Benninga lassebenni

View GitHub Profile
@cecilemuller
cecilemuller / example.yml
Created October 20, 2020 01:49
Run Docker Compose + in Github Action
name: Test
on:
push:
branches:
- main
- features/**
- dependabot/**
pull_request:
branches:
@lassebenni
lassebenni / bash.md
Last active January 20, 2021 10:36
#bash tricks

Output intermediate results to terminal using tee

TLDR; tee /dev/tty

Use the tee /dev/tty command in between pipes. This outputs the current STDIn to the terminal. This helps you to confirm the result in between pipes.

$ echo "hello" | sed -e 's/o//g' | tee /dev/tty | sed -e 's/hell/heaven/g' hell heaven

@poros
poros / pytest_parametrize_ids.py
Created October 6, 2015 01:38
Parametrized pytest testcase with dictionary of parameters and human readable testcase names
test_params = {
'empty_line': ('', {}),
'get_ok': ('GET 200', {'request': 'GET', 'status': '200'}),
'get_not_found': ('GET 404', {'request': 'GET', 'status': '404'}),
}
@pytest.mark.parametrize('line,expected', test_params.values(), ids=test_params.keys())
def test_decode(self, line, expected):
assert Decoder().decode(line) == expected
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();