Skip to content

Instantly share code, notes, and snippets.

Background: #202020
Font: Monaco, 11pt
Text: #CFCFCF
Bold Text: #CFCFCF
Selection: #CFCFCF (65% Opacity) / #9C9C9C
Cursor: #CFCFCF
ANSI Colours:
Black (0): #151515
Bright Black (8): #3E3E3E
Red (1): #9A2D32
# /etc/csh.login OR ~/.login
setenv SHELL /bin/bash
exec /bin/bash -l
@joesavage
joesavage / commands.txt
Last active August 11, 2016 06:41
`dwarfdump` on macOS and Linux
=== macOS
$ clang -v
Apple LLVM version 7.0.2 (clang-700.1.81)
<snip>
$ clang hello.c -g -o hello.out
$ dwarfdump hello.out # NOTE: macOS-specific binary that reads Mach-O rather than ELF executables
----------------------------------------------------------------------
File: hello.out (x86_64)
----------------------------------------------------------------------
.debug_info contents:
@joesavage
joesavage / wsp.py
Created March 17, 2019 15:25
Halldorsson's algorithm (WSP)
from math import sqrt
# Find an approximate solution to the weighted set packing problem using
# Halldorsson's algorithm (2000). Our approximate solution is at worst only a
# factor of sqrt(m) worse than the optimal solution.
#
# Input:
# S = { a, b, c... } # Set of base elements (m = |S|)
# C = { C_1, C_2, C_3, ... } # Collection of weighted subsets of S
# C_i = ({ a, c, ... }, weight) # Weighted subset of S