Skip to content

Instantly share code, notes, and snippets.

View skull-squadron's full-sized avatar
💭
*aaS unreleased project in Elixir, Rust, Typescript, Kafka, and k8s

🏴‍☠️ skull-squadron

💭
*aaS unreleased project in Elixir, Rust, Typescript, Kafka, and k8s
  • (stealth)
  • ATX
  • 22:41 (UTC -06:00)
View GitHub Profile
@skull-squadron
skull-squadron / fix-go-1.21.13.diff
Last active July 17, 2025 14:07
Fix go-1.21.13 building on amd64/aarch64 on Rosetta 2
--- a/src/crypto/tls/handshake_client_test.go 2025-07-17 13:07:13.898915009 +0000
+++ b/src/crypto/tls/handshake_client_test.go 2025-07-17 12:51:59.420067002 +0000
@@ -1779,6 +1779,7 @@
test.configureClient(clientConfig, &clientCalled)
testHandshakeState := func(name string, didResume bool) {
+ t.Skip("Doesn't work on amd64 on Rosetta 2 or on QEMU")
_, hs, err := testHandshake(t, clientConfig, serverConfig)
if err != nil {
t.Fatalf("%s: handshake failed: %s", name, err)
@skull-squadron
skull-squadron / fix-go1.19.13.diff
Last active July 17, 2025 10:19
Patch to make go 1.19.13 install on amd64 on Rosetta 2
--- a/crypto/tls/handshake_client_test.go 2025-07-17 09:17:22.598688001 +0000
+++ b/crypto/tls/handshake_client_test.go 2025-07-17 09:20:10.546419009 +0000
@@ -1755,6 +1755,7 @@
t.Errorf("%s: expected server VerifyConnection called %d times, did %d times", name, wantCalled, serverCalled)
}
}
+ t.Skip("Doesn't work on amd64 on Rosetta 2 or on QEMU")
testHandshakeState(fmt.Sprintf("%s-FullHandshake", test.name), false)
testHandshakeState(fmt.Sprintf("%s-Resumption", test.name), true)
}
@skull-squadron
skull-squadron / fix-go-1.4-bootstrap.diff
Created July 17, 2025 08:48
Patch to make go 1.4 build and test on amd64 under Rosetta 2
--- a/os/exec/exec_test.go 2025-07-17 08:31:03.824802001 +0000
+++ b/os/exec/exec_test.go 2025-07-17 08:40:30.611330000 +0000
@@ -262,6 +262,7 @@
}
func closeUnexpectedFds(t *testing.T, m string) {
+ t.Skip("Doesn't work on amd64 on Rosetta 2 or on QEMU")
for fd := basefds(); fd <= 101; fd++ {
err := os.NewFile(fd, "").Close()
if err == nil {
@skull-squadron
skull-squadron / derivatives.py
Created June 30, 2025 20:51 — forked from elfsternberg/derivatives.py
Python parsing with derivatives.
#!/usr/bin/env python
# This file implements Brzozowski's parsing-with-derivatives (see:
# https://arxiv.org/abs/1604.04695) with fairly simple and
# straightforward Python code. This implementation is naive and
# subject to exponential memory growth in the worst case; in practice,
# average complexity is closer to linear. This version recalculates
# derivatives every time they are needed; memoization, the first and
# most obvious optimization, is not implemented.
#
@skull-squadron
skull-squadron / aalib.rb
Created June 23, 2025 18:19
Fixed aalib
class Aalib < Formula
desc "Portable ASCII art graphics library"
homepage "https://aa-project.sourceforge.net/aalib/"
url "https://downloads.sourceforge.net/project/aa-project/aa-lib/1.4rc5/aalib-1.4rc5.tar.gz"
sha256 "fbddda9230cf6ee2a4f5706b4b11e2190ae45f5eda1f0409dc4f99b35e0a70ee"
license "GPL-2.0-or-later"
revision 2
depends_on 'autoconf' => :build
depends_on 'automake' => :build
@skull-squadron
skull-squadron / demacl
Created June 21, 2025 17:19
remove com.apple.macl xattr
#!/bin/bash
# Free fucking beer license. It may break and you assume all responsibility.
set -eEuo pipefail
die() {
echo >&2 "$@"
exit 1
}
[[ $# = 1 ]] || die "$0 {target} <-- missing file or directory to remove all xattrs from"
@skull-squadron
skull-squadron / type_name.rs
Created May 19, 2025 20:31
Rust anything (as opposed to just `Any`) type's to string
pub trait TypeName {
fn type_name(&self) -> &str {
std::any::type_name::<Self>().trim_start_matches("dyn::")
}
}
impl<T> TypeName for T {}
#[cfg(test)]
mod tests {
@skull-squadron
skull-squadron / replace_str.rs
Last active May 20, 2025 04:30
Rust replace beginning of string generically
use std::borrow::Cow;
pub trait ReplaceBeginning<'a>: Into<Cow<'a, str>> {
fn replace_beginning(
self,
prefix: impl AsRef<str>,
replacement: impl AsRef<str>,
) -> Cow<'a, str> {
let new_self = self.into();
let prefix = prefix.as_ref();
@skull-squadron
skull-squadron / make_loop.rs
Created May 16, 2025 09:57
make_loop! Ruby while and until, and C for loop syntactic sugar
#[macro_export]
macro_rules! make_loop {
// do { ... } while cond
(
do $body:block while $cond:expr
) => {
loop {
$body
if !$cond { break; }
}
@skull-squadron
skull-squadron / fix.rb
Created May 16, 2025 04:52
Homebrew fix for macOS 15.4+ / clang 17+ zlib _stdio.h:314:7: error: expected identifier or '('
class NodeAT18 < Formula
# ...
def install
# Workaround clang 17+ breaking bug
if OS.mac? && DevelopmentTools.clang_build_version >= 1700
ENV.append_to_cflags "-fno-define-target-os-macros"
end