Skip to content

Instantly share code, notes, and snippets.

View danielhenrymantilla's full-sized avatar
🦀

Daniel Henry-Mantilla danielhenrymantilla

🦀
View GitHub Profile
@ara4n
ara4n / catalyst.md
Created December 21, 2022 02:13
Compiling rust libraries under Catalyst (macabi) on Ventura (macOS 13.1)

Fixing rust to support compiling libraries for use with Catalyst (Dec 2022)

The problem is that rustc emits synthetic libraries (symbols.o and lib.rmeta) which Apple's ld then chokes on when targetting aarch64-apple-ios-macabi, as they lack an LC_BUILD_VERSION load command to identify them as being intended for use with Catalyst.

The errors produced look like:

ld: in /Users/matthew/workspace/matrix-rust-sdk/target/aarch64-apple-ios-macabi/dbg/deps/libstatic_assertions-fdafb4b8ba800a8a.rlib(lib.rmeta), building for Mac Catalyst, but linking in object file built for , file '/Users/matthew/workspace/matrix-rust-sdk/target/aarch64-apple-ios-macabi/dbg/deps/libstatic_assertions-fdafb4b8ba800a8a.rlib' for architecture arm64

@jmg-duarte
jmg-duarte / parse_quote_dbg.rs
Last active May 6, 2023 19:10
Yandros parse_quote! debug
// Credits: Yandros#4299
macro_rules! parse_quote {(
$($code:tt)*
) => ({
eprintln!("[{}:{}:{}] parse_quote! {{ {} }}", file!(), line!(), column!(), quote!( $($code)* ));
::syn::parse_quote!( $($code)* )
})}
macro_rules! parse_quote {(
@kvverti
kvverti / monads.md
Last active September 22, 2024 18:26
What the heck are monads anyway?

What the Heck is a Monad, Anyway?

Querying one's favorite search engine with the text "a monad is" yields this answer on StackOverflow, which explains, in excruciating mathematical symbology, what a monad in fact is. But, don't worry. Understanding monads doesn't require you to learn the nuances of such concepts as moirails and eigenfunctors. I would suggest that the concept of monads can be distilled into a clearer single sentence.

A monad is a control abstraction that defines a composition of effectful functions.

Let's unpack.

@stevecondylios
stevecondylios / resize-image-in-github-issue-github-flavored-markdown.md
Last active November 10, 2024 11:07
How to Resize an Image in a Github Issue (e.g. Github flavored Markdown)

How to Resize an Image in Github README.md (i.e. Github Flavored Markdown)

Percentage:

<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width=50% height=50%>

Pixels:

<img src="https://user-images.githubusercontent.com/16319829/81180309-2b51f000-8fee-11ea-8a78-ddfe8c3412a7.png" width="150" height="280">

@azriel91
azriel91 / workspace_coverage.sh
Created May 26, 2019 05:36
Script to collect Rust workspace coverage using kcov
#! /bin/bash
set -e
# Release options
profile=debug
# Directories
self_dir="$(dirname "$(readlink -f "${BASH_SOURCE}")")"
repository_dir="$(dirname "${self_dir}")"
target_dir="${repository_dir}/target"
@danielhenrymantilla
danielhenrymantilla / lib.rs
Created July 7, 2018 13:21
Rust: &self sugar vs other &identifier bindings
/* The following lib tests illustrate a lack of consistency in rust:
* the &identifier binding leads to 2 different behaviors based on whether
* - the identifier is the special 'self' first argument of a method,
* - or a simple variable / argument (called slf in the following tests)
*/
#![allow(dead_code, unused_variables, unused_parens)]
/* compiler ensures that check_ref::<T>(x) can only be called iff x: &T */
fn check_ref<T> (_: &T) {}
@Liryna
Liryna / ARMDebianUbuntu.md
Last active October 13, 2024 16:16
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""