Skip to content

Instantly share code, notes, and snippets.

View asandroq's full-sized avatar

Alex Silva asandroq

View GitHub Profile
@asandroq
asandroq / binary_tree.rs
Last active September 30, 2022 13:34
Informational code for implementing a binary search tree in Rust.
#![deny(clippy::all, clippy::pedantic)]
use std::cmp::Ordering;
/// A binary search tree.
#[derive(Debug)]
pub enum BinaryTree<T> {
/// Leaf node
Leaf,
(function(){
const delayMs = 500;
const keywords = `Prova do líder
BBB21
Tiago Leifert
paredão
BBB
BBB 21
Big brother
@asandroq
asandroq / quicksort.cpp
Last active April 14, 2020 14:21
quicksort with bidirectional iterators
// Iterators need only be bidirectional, no random access needed
template <typename Iterator> void quicksort(const Iterator begin, const Iterator end)
{
// empty sequence
if (begin == end) {
return;
}
auto right = end;
right--;
@asandroq
asandroq / result.txt
Created July 9, 2019 07:09
Running Idris2 tests
✔ ~/Downloads/Projects/Idris2 [master|✚ 1…234]
08:53 $ make
idris --build idris2.ipkg
Entering directory `./src'
Leaving directory `./src'
idris --build tests.ipkg
Entering directory `./tests'
Leaving directory `./tests'
make -C tests
../runtests ../../../idris2
data Last : List a -> a -> Type where
LastOne : Last [val] val
LastCons : (prf : Last xs val) -> Last (x :: xs) val
Uninhabited (Last [] val) where
uninhabited LastOne impossible
uninhabited (LastCons _) impossible
isLast : DecEq a => (xs : List a) -> (val : a) -> Dec (Last xs val)
isLast [] val = No absurd
@asandroq
asandroq / log.txt
Created November 19, 2018 10:21
Debug output of `vagrant up --debug`
This file has been truncated, but you can view the full file.
INFO global: Vagrant version: 2.2.1
INFO global: Ruby version: 2.4.4
INFO global: RubyGems version: 2.6.14.1
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/embedded"
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/2.2.1/gems/vagrant-2.2.1/bin/vagrant"
INFO global: VAGRANT_LOG="debug"
WARN global: resolv replacement has not been enabled!
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/2.2.1/gems/vagrant-2.2.1/plugins/synced_folders/rsync/plugin.rb

Keybase proof

I hereby claim:

  • I am asandroq on github.
  • I am asandroq (https://keybase.io/asandroq) on keybase.
  • I have a public key ASBQhFo9dl5SiM6yi_BC8Vwa0R1FUmqMkXR8HwWWSTesVwo

To claim this, I am signing this object:

[alias]
st = status -sb
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
lulz = log --pretty=oneline --name-status
[color]
ui = auto
@asandroq
asandroq / build_gcc.sh
Created September 17, 2013 07:35
Script for automating GCC's build.
#!/bin/sh
set -x
set -e
PREFIX='/opt/gcc'
WGET='wget --tries=3'
GCC_URL='http://gcc.cybermirror.org/releases/gcc-4.8.1/gcc-4.8.1.tar.bz2'
GMP_URL='http://mirror.switch.ch/ftp/mirror/gnu/gmp/gmp-5.1.2.tar.bz2'
@asandroq
asandroq / memory_fd.c
Last active December 20, 2015 19:19
How to read from memory using a file descriptor
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h> /* For mode constants */
#include <fcntl.h> /* For O_* constants */
const char source[] =
"Generalized algebraic data types (GADTs) are a feature of functional "