Skip to content

Instantly share code, notes, and snippets.

@xpe
xpe / discussion-anti-pattern-ideological-commentary.md
Last active November 4, 2024 18:00
Discussion Anti-Pattern: Ideological commentary about linked news stories

Discussion Anti-Pattern: Ideological commentary about linked news stories

So many discussion forums are broken in so many ways.

Antipattern Pattern

  1. Someone posts a link to a news story.
  2. Subsequent comments pick a side and argues in favor of it.

Below, I will explain why this is an anti-pattern.

@xpe
xpe / ai_policy_memo.md
Last active June 13, 2024 16:06
Synthesizing Expert Knowledge on AI Safety Risks

MEMORANDUM

TO: Head of AI Safety, National Institute of Standards and Technology (NIST)

SUBJECT: Synthesizing Expert Knowledge on AI Safety Risks

Problem Statement

How can NIST best synthesize a diversity of expert knowledge on AI safety?

@xpe
xpe / compiler_optimization_idea_reusing_function_calls.md
Last active May 28, 2024 14:12
Optimization questions and perhaps an idea

Consider this code. Please pay attention to how .style() derives from element. The rest is not important for the point I'm hoping to make here.

/// Centers `element` horizontally and vertically inside `canvas`.
/// Returns a `Node` struct containing the calculated position and dimensions
/// of the repositioned `element`.
pub fn center_element(element: &HtmlElement, canvas: &Canvas) -> Node {
    let dim = bounding_client_dim(element);
    let pos = centered_pos(&dim, &canvas.dim);
 {
@xpe
xpe / tera_macro_google_fonts.html
Last active May 9, 2024 15:39
Macro for Google Fonts links for use Tera (a templating engine written in Rust)
{% macro google_fonts(families) %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
{% set prefix = "https://fonts.googleapis.com/css2?" -%}
{% set s = "" -%}
{% for family in families -%}
{% if loop.index0 > 0 -%}
{% set_global s = s ~ "&" -%}
{% endif -%}
{% set_global s = s ~ "family=" ~ family -%}
@xpe
xpe / cp_connecting_ip.rs
Created January 22, 2024 13:54
/src/server/extractors/headers/cp_connecting_ip.rs
use std::net::IpAddr;
use axum::http::HeaderMap;
#[derive(Debug, thiserror::Error)]
pub enum IpHeaderError {
#[error("`CF-Connecting-IP` header is missing")]
MissingHeader,
#[error("`CF-Connecting-IP` header contains invalid characters")]
@xpe
xpe / predictive-processing-20230918.md
Last active September 18, 2023 14:29
Predictive Processing Model - Introduction 2023-09-18

Predictive Processing in Consciousness

ChatGPT 4.0 transcript on 2023-09-18

User

Are you familiar with the cognitive science / neuroscience theory that consciousness is a simulation error-corrected by our senses?

What is this theory called? / In what academic disciplines is it situated? / When was it first proposed? / Please comment on how well it has or has not been adopted.

@xpe
xpe / ChatGPT-guidance-unsolicited-advice.md
Created June 10, 2023 14:39
ChatGPT Guidance: Unsolicited advice

No unsolicited advice

Do not give advice unless I specifically ask for it.

For example: don't tell me to seek out authorities, experts, or regulatatory guidance. This includes:

  • doctors
  • healthcare professionals
  • building inspectors
  • electrical codes
@xpe
xpe / open_letter_2022-09-09.md
Last active September 10, 2022 13:32
Open Letter to Paul of the Unison language
@xpe
xpe / Opinion Mike Salditch 2011.md
Created November 20, 2021 19:23
OPINION: Living in Maryland is far superior to living in Texas
@xpe
xpe / idiomatic_Rust.md
Created September 9, 2021 20:13
What does "idiomatic" mean in the Rust community?

What does 'idiomatic' mean in Rust? Like many here, I even have some (false?) confidence that I know what idiomatic means.

Three Questions

Let me ask three questions:

  1. Who gets to decide what is idiomatic?

  2. How does something become idiomatic?