Skip to content

Instantly share code, notes, and snippets.

View notpeter's full-sized avatar
🦆

Peter Tripp notpeter

🦆
View GitHub Profile
@narain
narain / sim-rect-diss.sage
Created December 19, 2022 15:43
Dissection of a square into n similar rectangles via guillotine cuts
from dataclasses import dataclass
from typing import Any
from sage.all import *
n = 4
# A guillotine partition is a binary tree of horizontal and vertical cuts.
# In our problem each leaf node is a horizontal or vertical rectangle.
# For example, 3 vertical cuts and 4 vertical rectangles produce [ | | | ]
@jaames
jaames / main.c
Last active November 27, 2023 03:29
Playdate C memory management functions (and extras!) as macros
// usage example in your C entry file...
#include "pd_api.h"
#include "platform.h"
PlaydateAPI *pd = NULL;
int eventHandler(PlaydateAPI *playdate, PDSystemEvent event, uint32_t arg)
{
if (event == kEventInitLua) {
@JonathanThorpe
JonathanThorpe / wav-riff-reader.py
Last active June 11, 2023 17:32
Python WAV File RIFF Header Reader
import struct
import io
class WAVFile:
def __init__(self, filename):
self.filename = filename
def read(self):
with io.open(self.filename, 'rb') as fh:
@smoser
smoser / README.md
Last active March 29, 2024 07:19
set up a ssh tunnel only user for ssh proxy jump

Set up a ssh tunnel only user

In order to give someone access to hosts that are available only by ssh "bouncing" (ProxyJump), add a user for this specific purpose.

We have an internal openstack where instances get IPs on per-tenant networks. Each tenant has a 'bastion' host that has a "public" ip (floating ip). You can access other instances by bouncing through the bastion. From time to time I want to let someone else into an instance. This could be done either with:

a.) just give them shell access to the bastion and let them hop through. Sharing an unrestricted shell account on my bastion is less than ideal. b.) assign a floating/"public" IP to the instance so they could go directly in. Floating IPs are limited, so this is less than ideal.

So instead, I have set up a single user as described here that can only be used for ProxyJump. It allows others proxied access to my instances but without granting them full shell access.

@gtallen1187
gtallen1187 / scar_tissue.md
Created November 1, 2015 23:53
talk given by John Ousterhout about sustaining relationships

"Scar Tissues Make Relationships Wear Out"

04/26/2103. From a lecture by Professor John Ousterhout at Stanford, class CS142.

This is my most touchy-feely thought for the weekend. Here’s the basic idea: It’s really hard to build relationships that last for a long time. If you haven’t discovered this, you will discover this sooner or later. And it's hard both for personal relationships and for business relationships. And to me, it's pretty amazing that two people can stay married for 25 years without killing each other.

[Laughter]

> But honestly, most professional relationships don't last anywhere near that long. The best bands always seem to break up after 2 or 3 years. And business partnerships fall apart, and there's all these problems in these relationships that just don't last. So, why is that? Well, in my view, it’s relationships don't fail because there some single catastrophic event to destroy them, although often there is a single catastrophic event around the the end of the relation