Linux limits

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _LINUX_LIMITS_H
#define _LINUX_LIMITS_H

#define NR_OPEN         1024

#define NGROUPS_MAX    65536    /* supplemental group IDs are available */
#define ARG_MAX       131072    /* # bytes of args + environ for exec() */
#define LINK_MAX         127    /* # links a file may have */
#define MAX_CANON        255    /* size of the canonical input queue */
#define MAX_INPUT        255    /* size of the type-ahead buffer */
#define NAME_MAX         255    /* # chars in a file name */
#define PATH_MAX        4096    /* # chars in a path name including nul */
#define PIPE_BUF        4096    /* # bytes in atomic write to a pipe */
#define XATTR_NAME_MAX   255    /* # chars in an extended attribute name */
#define XATTR_SIZE_MAX 65536    /* size of an extended attribute value (64k) */
#define XATTR_LIST_MAX 65536    /* size of extended attribute namelist (64k) */

#define RTSIG_MAX         32

#endif

std::string tricks

Concise code to extract everything after the slash (if there is one) without checking std::string::npos. The +1 rounds a “not found” value up to zero if there’s no slash and then substr returns the original string.

#include <iostream>

int main() {

  const std::string full_path = "one/two.jpg";
  const std::string just_the_file_name = full_path.substr(full_path.find_last_of('/') + 1);

  std::cout << "\"" << just_the_file_name << "\"\n";
}

The lighthouse keeper's son

John James Turpin’s memories of growing up in occupied Jersey at La Corbière lighthouse. Born in 1930. Chapter 1 My father was a full time naval man. Having served before the First World War up until the late twenties, he joined the lighthouse service. He was then in a position to bring his family to the lighthouse cottage which consisted of my mother, my two brothers, my sister and of course myself. [Read More]

GDB

Debugger crib sheet

Adding debug symbols gcc -g hello.c gdb a.out # Run program run # Run and immediately break start # View code at current break point list # Break main b main # Break at line 9 b 9 TUI mode - text user interface Type ctrl-X A ctrl L - repaint ctrl X2 - multiple windows ctrl X2 - view registers tui reg float - view floating registers ctrl x 1 - source code view ctrl p/n - command history Python interpreter built in (since version 7) import os print(os. [Read More]

Big data

A consolidated list of sources

Sources of big data Big data communities and platforms http://archive.ics.uci.edu/ml/index.php Kaggle Statista Data World Data Hub AWS open data Google public data Crime https://www.fbi.gov/services/cjis/ucr https://www.pcr.uu.se/research/UCDP/ https://www.drugabuse.gov/drug-topics/trends-statistics Internet https://wiki.dbpedia.org/ https://trends.google.com/trends/explore Reddit datasets Government https://www.ukdataservice.ac.uk/ https://data.gov.uk/ https://data.london.gov.uk/ https://www.data.gov/ https://opengovernmentdata.org/data/ https://www.cia.gov/library/publications/the-world-factbook/ https://data.gov.au/ https://opendata.cityofnewyork.us/ https://open.canada.ca/en/open-data Mathematics I got 717 problems… Project Euler problems Health https://healthdata.gov/ https://digital.nhs.uk/data-and-information/data-collections-and-data-sets https://www.who.int/data/collections https://www.who.int/gho/maternal_health/reproductive_health/en/ http://portals.broadinstitute.org/cgi-bin/cancer/datasets.cgi https://www.cdc.gov/datastatistics/ https://www.fda.gov/drugs/drug-approvals-and-databases/drugsfda-data-files https://github.com/publichealthengland/coronavirus-dashboard 1000 Genomes project USDA food composition Business https://www. [Read More]

Miso-seaweed bread

Quantities and general technique

Ingredients Proportion Ingredient grammes 100% Shipton Mill white organic bread flour 500 65% Evian mineral water 325 10% Sanchi Hatcho Miso 50 5% Fresh yeast 25 2% Billington’s Organic Golden Granulated 10 2% Poppy seeds 10 2% Sussex Gold extra virgin rapeseed oil 10 0.5% Dried seaweed 2.5 You can replace the miso with 2% Pro Fusion Himalayan Rose Pink salt. [Read More]

Learning circular breathing

On the didgeridoo

I’ve been playing for a few months so it’s time to give something back. I gave myself a month to learn circular breathing. You need to immerse yourself in the culture and practice: go into a YouTube flat spin. Commit to 20 minutes a day, no excuses. And it’s difficult. The first few weeks you’ll be building up the muscles you haven’t used before and it’s very hard to measure progression. [Read More]