Skip to content

Instantly share code, notes, and snippets.

View booniepepper's full-sized avatar
🌶️

Justin "J.R." Hill booniepepper

🌶️
View GitHub Profile
@booniepepper
booniepepper / break.py
Created November 3, 2023 21:39 — forked from obfusk/break.py
python "breakpoint" (more or less equivalent to ruby's binding.pry); for a proper debugger, use https://docs.python.org/3/library/pdb.html
import code; code.interact(local=dict(globals(), **locals()))
@booniepepper
booniepepper / install.md
Last active October 13, 2023 19:57
Install protonmail-bridge on Void (and other) Linux distro

Official installation instructions from Proton are here:


Disclaimers:

  • As of writing, using the Proton Mail Bridge is only supported for users with a paid account.
  • This guide will probably work out of the box for many users. If it doesn't work
@booniepepper
booniepepper / monad.py
Last active September 25, 2023 15:53
Monads
from abc import ABC
from typing import Callable, Generic, TypeVar
A = TypeVar('A')
B = TypeVar('B')
class Monad(ABC, Generic[A]):
@abstractmethod
def unit(A) -> Monad[A]:
raise NotImplementedError("unit")
@booniepepper
booniepepper / dt-server.js
Last active September 20, 2023 23:04
naive dt server with Bun+Elysia
#!/usr/bin/env bun
import { Elysia } from 'elysia'
const { spawn, readableStreamToText } = Bun
// TODO: Take -p=PORT argument, handle --help with USAGE
const PORT = 3000;
const pipe = (...fns) => arg => fns.reduce((acc, f) => f(acc), arg)
const get = prop => obj => obj[prop]
@booniepepper
booniepepper / abandoned-mocking-of-httpclient-snippet.java
Last active March 28, 2024 19:07
Mocking java.net.http.HttpClient: Mockito vs HttpClientMock
@Test
public void check() throws Exception {
// Given
HttpResponse<InputStream> rawResponse = basicHttpOkResponse();
when(mockHttpClient.<InputStream>send(any(), any())).thenReturn(rawResponse);
CheckRequest request = new CheckRequest()
.tupleKey(new TupleKey())
.contextualTuples(new ContextualTupleKeys())
.authorizationModelId(DEFAULT_AUTH_MODEL_ID);
@booniepepper
booniepepper / Scratch.java
Created December 20, 2018 06:48
container of abstract objects with safe casting
import java.util.HashMap;
import java.util.Map;
class Scratch {
public static void main(String[] args) {
final Container container = new Container();
container.addData(DataType.AGE, 10);
container.addData(DataType.NAME,"ken");
container.addData(DataType.JOB, "student");