Skip to content

Instantly share code, notes, and snippets.

View Bklyn's full-sized avatar

Caleb Epstein Bklyn

  • Brooklyn Dust Bunny Mfg.
  • Location, Location, Location
View GitHub Profile
@Bklyn
Bklyn / Working GDB on macOS 11.md
Created March 21, 2023 13:24 — forked from mike-myers-tob/Working GDB on macOS 11.md
Steps to get GDB actually working in April 2021 on macOS (Intel x86-64 only)

Debug with GDB on macOS 11

The big reason to do this is that LLDB has no ability to "follow-fork-mode child", in other words, a multi-process target that doesn't have a single-process mode (or, a bug that only manifests when in multi-process mode) is going to be difficult or impossible to debug, especially if you have to run the target over and over in order to make the bug manifest. If you have a repeatable bug, no big deal, break on the fork from the parent process and attach to the child in a second lldb instance. Otherwise, read on.

Install GDB

Don't make the mistake of thinking you can just brew install gdb. Currently this is version 10.2 and it's mostly broken, with at least two annoying bugs as of April 29th 2021, but the big one is https://sourceware.org/bugzilla/show_bug.cgi?id=24069

$ xcode-select install  # install the XCode command-line tools
@Bklyn
Bklyn / .block
Last active October 11, 2017 16:07 — forked from mbostock/.block
Bullet Charts
license: gpl-3.0
@Bklyn
Bklyn / rename.pl
Created January 6, 2017 14:11
Classic Perl file renaming script (rename.pl aka prename)
#!/usr/bin/perl -w
#
# This script was developed by Robin Barker (Robin.Barker@npl.co.uk),
# from Larry Wall's original script eg/rename from the perl source.
#
# This script is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
# Larry(?)'s RCS header:
# RCSfile: rename,v Revision: 4.1 Date: 92/08/07 17:20:30
@Bklyn
Bklyn / chmodsym.py
Created August 16, 2016 13:27
Symbolic chmod in Python
# Found on https://www.daniweb.com/programming/software-development/code/243659/change-file-permissions-symbolically-linux
""" module chmodsym.py (linux)
This module defines a function chmod(location, description)
which allows to change a file's permission with a symbolic
description of the mode, similar to the shell command 'chmod'.
Tested with python 2.6 and 3.1.
"""
import os, stat
import functools
@Bklyn
Bklyn / object-size.sql
Created April 15, 2015 21:24
PostgreSQL Object Size
-- From: https://wiki-bsse.ethz.ch/display/ITDOC/Check+size+of+tables+and+objects+in+PostgreSQL+database
-- Check size of tables and objects in PostgreSQL database
-- Created by Rinn Bernd (ID SIS), last modified on Oct 11, 2011 Go to start of metadata
-- To get an overview about how much space is taken by what database, call:
SELECT
pg_database.datname,
pg_size_pretty(pg_database_size(pg_database.datname)) AS size
FROM pg_database;
To get more details, call:
SELECT
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
"""
sqla2hdfstore
===============
Input:
sqlalchemy uri
@Bklyn
Bklyn / swap-use.sh
Created October 10, 2014 15:33
Swap space usage by process
perl -ne 'chomp; $name=$1 if /Name:\s+([^ ]+)/; $pid=$1 if /^Pid:\s+(\d+)/; \
printf "%-16s %5d %16s\n", $name, $pid, $1 if /VmSwap:\s*([1-9]\d*) kB/' /proc/*/status 2> /dev/null | \
sort -rn -k3