Designed for multi-threaded, multi-process, and advanced use cases. Convert with:
pandoc -o gdb-advanced.odt gdb-advanced.md
and play with the odt until happy, then export as .pdf.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Convenience functions to stream output from std:: data structures. | |
* | |
* Useful when you do not have a debugger. See test below to get a sense of | |
* what's available. | |
* | |
*/ | |
#include <gmock/gmock.h> | |
#include <gtest/gtest.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Simulate clients writing log files to a drive with fio (see https://bsdio.com/fio/) | |
; | |
; numbjobs: number of clients | |
; rate_iops: number of writes per seconds | |
; bs: size of the log entry | |
; size: total size of the log file | |
; | |
; Normally, the iops reported by fio should be rate_iops x numbjobs | |
[global] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numexpr as ne | |
import pandas as pd | |
import matplotlib | |
import matplotlib.pyplot as plt | |
%load_ext autoreload | |
%autoreload 2 | |
%matplotlib inline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def top(df, n, columns=None): | |
"""Returns top and bottom n elements subset of input dataframe. | |
Args: | |
df: input dataframe. | |
n: number of elements to return (n / 2 on top and on the bottom). | |
columns: list of columns to consider for sorting, defaults to use | |
head and tail. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_data_frame_equality_func(test): | |
"""Define test class to handle assertEqual with `pandas.DataFrame`.""" | |
def frame_equal(lhs, rhs, msg=None): | |
"""Adapter for pandas.testing.assert_frame_equal.""" | |
if msg: | |
try: | |
pdt.assert_frame_equal(lhs, rhs) | |
except AssertionError as err: | |
raise test.failureException(msg) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- creates fdw to the database quotes in a schema quotes_s | |
create extension if not exists postgres_fdw; | |
create server prod_s foreign data wrapper postgres_fdw options (host 'servername', dbname 'quotes', port '5432'); | |
create user mapping for public server prod_s options (user 'name', password 'secret'); | |
create schema quotes_s; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sns.set(style='whitegrid', context='notebook', font_scale=1.5) | |
sns.pairplot(df[cols]) | |
plt.show() |
NewerOlder