Skip to content

Instantly share code, notes, and snippets.

@rain-1
rain-1 / closure-conversion.rkt
Created February 16, 2019 10:06
Closure Conversion
#lang racket
;; this is a stand alone simple version of the closure conversion part of the hoist pass from the tarot compiler
;; see https://rain-1.github.io/scheme for more.
(require data/queue)
;; closure conversion for lambda calculus
;;
;; the input language is:
@troughton
troughton / main.swift
Last active November 30, 2018 11:17
Swift Tromino Algorithm - Windows Test
import Swift
print("Hello")
struct Position : Hashable {
let x : Int
let y : Int
var hashValue: Int {
return 31 &* x &+ y
@sgraham
sgraham / fidl.js
Created September 20, 2018 21:30
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// WARNING: This file is machine generated by fidlgen_js.
/**
* @enum {number}
*/
const Blorp = {
@KapiX
KapiX / 0000-README.md
Last active September 28, 2022 09:24
QtWebEngine Haiku patchset

These patches are for qtwebengine-everywhere-src-5.12.3.tar.xz, SHA256: 3ff3bac12d75aa0f3fd993bb7077fe411f7b0e6a3993af6f8b039d48e3dc4317

Linking stage for QtWebEngineCore requires 10+GB of RAM :) (debug build)

Additional stuff needed:

Fixed libxslt.pc (non-packaged/develop/lib/pkgconfig) - qmake checks if directories in .pc files exist and will fail with some libs if libxslt was built with libxml2-2.6.2 and libxml2 was later updated to let's say libxml2-2.9.9, libxslt.pc will contain -L with non-existent directory (because it was not rebuilt with newer libxml2) Custom .pc file fixes this.

@nadavrot
nadavrot / Matrix.md
Last active May 5, 2024 08:37
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

impl Trait is Always Existential

Recently, Rust 1.26 was released, and with it came stable access to a heavily desired feature: impl Trait. For those unfamiliar, impl Trait lets you write something like this:

fn foo<'a, A, B>(x: &'a mut A) -> impl Bar<'a, B> { ... }

and have it be translated to something like this:

@dockimbel
dockimbel / eval2.red
Created April 3, 2018 10:12
Test script for Red/View Android backend
Red [
Title: "Red Android bridge demo"
Author: "Nenad Rakocevic"
File: %eval2.red
Config: [type: 'dll libRed?: no libRedRT?: yes export-ABI: 'cdecl]
Tabs: 4
Needs: 'View
Rights: "Copyright (C) 2013-2017 Nenad Rakocevic. All rights reserved."
License: {
Distributed under the Boost Software License, Version 1.0.
@dgruss
dgruss / example1.c
Created March 5, 2018 22:27
SASD Lecture Example
#include <signal.h>
#include <setjmp.h>
#include <stdio.h>
#include <execinfo.h>
static void unblock_signal(int signum __attribute__((__unused__)))
{
sigset_t sigs;
sigemptyset(&sigs);
sigaddset(&sigs, signum);
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
@jedi4ever
jedi4ever / gist:d095656ae0f0eca4a83ebb2b331da367
Last active January 11, 2024 22:01
Chromium build with proprietary codecs
@MateusZitelli
MateusZitelli / genetic_algorithm.py
Created December 10, 2017 05:16
Typesafe Genetic Algorithm in Python
from typing import Tuple, Iterable, Callable, TypeVar
import functools
Solution = TypeVar("Solution")
Population = Iterable[Solution]
EvaluatedPopulation = Iterable[Tuple[float, Solution]]
EvolutionState = Tuple[EvaluatedPopulation, bool]
FitnessFunction = Callable[[Solution], float]
Mutator = Callable[[Solution], Solution]