Skip to content

Instantly share code, notes, and snippets.

View pablochacin's full-sized avatar

pablochacin pablochacin

View GitHub Profile
@pablochacin
pablochacin / README.md
Last active August 23, 2019 13:57
POC for dynamic pytest fixture scope definition

Introduction

POC for dynamically defining the scope of a fixture based on a cli parameter.

session scope

pytest -s -v --scope=session
========================================= test session starts ==========================================
platform linux -- Python 3.6.5, pytest-5.0.0, py-1.5.2, pluggy-0.12.0 -- /usr/bin/python3
@pablochacin
pablochacin / README.me
Last active July 6, 2019 12:56
A minimalist BDD framework with fluent api
# Fluent BDD
Fluent BDD is a minimalistic testing framework with a fluent API.
A Scenario is defined as a sequence of Conditions, followed by
a series of Events and the Clauses that must be satiesfied at
the end. Multiple Conditions, Events and Clauses can be specified.
## Fluent API
Verifying that +pablochacin is my openname (Bitcoin username). https://onename.io/pablochacin
@pablochacin
pablochacin / parse_query.sh
Last active January 27, 2023 01:32
A one liner to parse a http query string in bash
#
# the following one liner creates a shell variable from every parameter in a
# the query string in the variable QUERY, of the form p1=v1&p2=v2,... and sets it to
# the corresponding value so that parameters can be accessed by its name $p1, $p2, ...
#
for p in ${QUERY//&/ };do kvp=( ${p/=/ } ); k=${kvp[0]};v=${kvp[1]};eval $k=$v;done
@pablochacin
pablochacin / watchdog.sh
Last active November 25, 2022 14:16
A bash function to execute another function and kill it if it takes longer than a given timeout. Much like the timeout command, but works with functions.
#
#executes another function as a subprocess and kills it if takes longer than a given timeout
# $1 timeout
# $2 name of function
# $@ argument list for function
function watchdog(){
local T=$1
local F=$2
shift;shift