Skip to content

Instantly share code, notes, and snippets.

View leonardbinet's full-sized avatar
🐑

Léonard Binet leonardbinet

🐑
View GitHub Profile
@leonardbinet
leonardbinet / README.md
Last active August 9, 2020 22:24
Python spier decorator

Suppose you want to want to track all calls (args, kwargs and result) made to a given method while running a command, you can do it using the simple decorator defined in the spy.py module of this gist.

Usage

You can use it to spy either on a single instance or to all instances of given class.

The calls will be stored in a list that must be passed by instantiated beforehand and passed to the decorator.

Spy on single instance

@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active May 22, 2024 09:39
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 22, 2024 17:32
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@sloria
sloria / bobp-python.md
Last active May 12, 2024 06:54
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens