Skip to content

Instantly share code, notes, and snippets.

@pudquick
pudquick / brew.md
Last active April 6, 2024 21:42
Lightly "sandboxed" homebrew on macOS

brew is a bad neighbor

This isn't a guide about locking down homebrew so that it can't touch the rest of your system security-wise.

This guide doesn't fix the inherent security issues of a package management system that will literally yell at you if you try to do something about "huh, maybe it's not great my executables are writeable by my account without requiring authorization first".

But it absolutely is a guide about shoving it into its own little corner so that you can take it or leave it as you see fit, instead of just letting the project do what it likes like completely taking over permissions and ownership of a directory that might be in use by other software on your Mac and stomping all over their contents.

By following this guide you will:

  • Never have to run sudo to forcefully change permissions of some directory to be owned by your account
@mgaitan
mgaitan / autofactory.py
Last active December 9, 2023 16:16
Automatically define factory boy recipes for dataclasses by inspecting the type annotations
## See https://github.com/FactoryBoy/factory_boy/issues/836
import inspect
from typing import List, get_args, get_origin
import factory
import factory.fuzzy
from dataclasses import dataclass, Field, MISSING, is_dataclass
from enum import Enum
from datetime import date, datetime
from decimal import Decimal
@mdo
mdo / 00-intro.md
Last active March 24, 2024 08:04
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

@153957
153957 / Mars.md
Last active October 30, 2016 18:53
Many Names of Mars
Name Language
Al-Qahira Arabic, Indonesian, Malay
Ares Greek
Auqakuh Quechua (Inca)
Bahram Persian
Harmakhis Ancient Egyptian
Her Desher Egyptian
Hrad Armenian
Huo Hsing Chinese
@braveulysses
braveulysses / sanitize_html.py
Created May 29, 2009 20:25
HTML sanitization using Python and BeautifulSoup
def sanitize(untrusted_html, additional_tags=None):
"""Strips potentially harmful tags and attributes from HTML, but preserves
all tags in a whitelist.
Passing the list additional_tags will add the specified tags to the whitelist.
The sanitizer does NOT encode reserved characters into XML entities. It is up
to the template code, if any, to take care of that.
Based on the work of: