Skip to content

Instantly share code, notes, and snippets.

@camthesaxman
camthesaxman / irixswextract.c
Created March 17, 2018 19:32
tool to extract IRIX software packages
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
struct Archive
extern crate memmap;
#[cfg(target_pointer_width = "32")]
const MAGIC_VALUE: usize = 0xdedbeef0;
#[cfg(target_pointer_width = "32")]
const WORD_SIZE: usize = 4;
#[cfg(target_pointer_width = "64")]
const MAGIC_VALUE: usize = 0xd0e0a0d0b0e0e0f0;
#[cfg(target_pointer_width = "64")]
const WORD_SIZE: usize = 8;
@14427
14427 / hkt.rs
Last active February 7, 2024 10:18
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
@sjoerdvisscher
sjoerdvisscher / profunctorlens.hs
Last active October 1, 2017 21:42
Pure profunctor lenses
{-# LANGUAGE Rank2Types #-}
import Control.Applicative (Applicative(..), (<$>), Const(..))
import Control.Lens.Internal.Review (Reviewed(..))
import Control.Lens.Internal.Bazaar (Bazaar(..))
import Data.Monoid (Monoid(..), First(..))
import Data.Profunctor
import Data.Profunctor.Rep
import Data.Functor.Identity
(ns cara.type.core)
;(declare Nothing Just)
(defprotocol PDataType
(get-constructors [self]))
(defprotocol PConstructor
(get-datatype [self]))
@jckarter
jckarter / factor-modules.md
Created August 23, 2012 19:57
Factor modules design

A package system for Factor

Factor's current module system and development model is heavily monolithic, reflecting Factor's history as a small-scale hobby project. The default settings encourage development within the Factor source tree and make it difficult to accommodate packaged read-only installations or projects developed outside of the source tree. Altering the module search path to accommodate these use cases is currently a manual and error-prone process. This proposal describes a new model for module lookup and installation with the following improvements:

  • a standardized search path for modules, allowing for global, user-local, project-local, and
(defmacro letfn- [fn-bindings & body]
(let [fn-names (map first fn-bindings)
fn-gensyms (into {} (for [f fn-names]
[f (gensym f)]))
delayed-bindings (for [f fn-names
x [(fn-gensyms f)
`(delay (~f ~@fn-names))]]
x)
forced-bindings (for [[n v] fn-gensyms
x [n `(force ~v)]]