Skip to content

Instantly share code, notes, and snippets.

View felipecrv's full-sized avatar

Felipe Oliveira Carvalho felipecrv

View GitHub Profile
@Hirrolot
Hirrolot / terminating-NbE.ml
Last active March 30, 2024 12:03
Terminating untyped NbE with a configurable limit
module Make_term (S : sig
type 'a t [@@deriving show]
end) =
struct
type t = def S.t
and def = Lam of t | Var of int | Appl of t * t
[@@deriving show { with_path = false }]
let _ = S.show
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active April 22, 2024 16:22
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:

@VictorTaelin
VictorTaelin / itt-coc.ts
Last active March 2, 2024 15:53
ITT-Flavored Calculus of Constructions Type Checker
// A nano dependent type-checker featuring inductive types via self encodings.
// All computation rules are justified by interaction combinator semantics,
// resulting in major simplifications and improvements over old Kind-Core.
// Specifically, computable annotations (ANNs) and their counterpart (ANN
// binders) and a new self encoding based on equality (rather than dependent
// motives) greatly reduce code size. A more complete file, including
// superpositions (for optimal unification) is available on the
// Interaction-Type-Theory repository.
// Credits also to Franchu and T6 for insights.
@bkietz
bkietz / find_first.hxx
Last active September 21, 2023 21:04
C++17 string search with SSE4.2's `_mm_cmpistrm`
#if defined(__SSE4_2__)
#if defined(__has_builtin)
#if __has_builtin(__builtin_ctz)
#include <immintrin.h>
#include <cstring>
#define ARROW_TOO_SIMD_FIND_FIRST_OF
#endif
@debasishg
debasishg / cache-oblivious.md
Last active April 12, 2024 18:22
Papers related to cache oblivious data structures

Cache Oblivious and Cache Aware Data Structure and Algorithms

  1. Cache-Oblivious Algorithms and Data Structures - Erik Demaine (One of the earliest papers in cache oblivious data structures and algorithms that introduces the cache oblivious model in detail and examines static and dynamic cache oblivious data structures built between 2000-2003)

  2. Cache Oblivious B-Trees - Bender, Demaine, Farch-Colton (This paper presents two dynamic search trees attaining near-optimal performance on any hierarchical memory. One of the fundamental papers in the field where both search trees discussed match the optimal search bound of Θ(1+log (B+1)N) memory transfers)

  3. Cache Oblivious Search Trees via Binary Trees of Small Height - Brodal, Fagerberg, Jacob (The data structure discussed in this paper works on the version of [2] but avoids the use o

@bkietz
bkietz / LICENSE.txt
Created June 23, 2023 13:08
Minimal C++17 utility for writing `concept`-like checks
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
@kamranrad1993
kamranrad1993 / lldb.txt
Created August 3, 2022 19:22 — forked from hotwatermorning/lldb.txt
Step into std::function with lldb of Xcode
(lldb) settings show target.process.thread.step-avoid-regexp
target.process.thread.step-avoid-regexp (regex) = ^std::
(lldb) settings set target.process.thread.step-avoid-regexp ""
http://stackoverflow.com/questions/19413181/step-into-stl-sources-in-xcode-5
@cobaohieu
cobaohieu / update-gcc.md
Last active April 4, 2024 09:43 — forked from patrickmmartin/PYTHON_DEFAULT.md
update-alternatives for gcc on Ubuntu

Run the following commands as root or user with sudo access to update the packages list and install the prerequisites: To install the Development Tools packages, run the following command as root or user with sudo privileges :

$ sudo apt update
$ sudo apt-get upgrade -y
$ sudo apt-get dist-upgrade -y
$ sudo apt-get install build-essential software-properties-common manpages-dev -y
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
$ sudo apt-get update -y
// The two sweetspots are 8-bit and 4-bit tags. In the latter case you can fit 14 32-bit keys in
// a cacheline-sized bucket and still have one leftover byte for metadata.
// As for how to choose tags for particular problems, Google's Swiss table and Facebook's F14 table
// both use hash bits that weren't used for the bucket indexing. This is ideal from an entropy perspective
// but it can be better to use some particular feature of the key that you'd otherwise check against anyway.
// For example, for 32-bit keys (with a usable sentinel value) you could use the 8 low bits as the tag
// while storing the remaining 24 bits in the rest of the bucket; that fits 16 keys per bucket. Or if the keys
// are strings you could store the length as the discriminator: with an 8-bit tag, 0 means an empty slot,
// 1..254 means a string of that length, and 255 means a string of length 255 or longer. With a 4-bit tag