Skip to content

Instantly share code, notes, and snippets.

View BraulioVM's full-sized avatar

Braulio Valdivielso Martínez BraulioVM

View GitHub Profile
braulio@hal:~/oss/tokio/tokio$ cargo tree --no-default-features --features fs -e features -i tokio
tokio v1.15.0 (/home/braulio/oss/tokio/tokio)
├── tokio feature "default"
│ ├── tokio-stream v0.1.8 (/home/braulio/oss/tokio/tokio-stream)
│ │ ├── tokio-stream feature "default"
│ │ │ └── tokio-test v0.4.2 (/home/braulio/oss/tokio/tokio-test)
│ │ │ └── tokio-test feature "default"
│ │ │ [dev-dependencies]
│ │ │ └── tokio v1.15.0 (/home/braulio/oss/tokio/tokio) (*)
│ │ │ [dev-dependencies]
@BraulioVM
BraulioVM / failures.txt
Created December 27, 2021 22:04
Test failures
2
9
5
2
3
3
7
2
2
2
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
seen_numbers_to_indices = {}
for i, number in enumerate(nums):
candidate_index = seen_numbers_to_indices.get(target - number)
if candidate_index is not None:
return [candidate_index, i]
@BraulioVM
BraulioVM / STLC.hs
Created August 15, 2018 10:52
Safe Simply Typed Lambda Calculus
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
@BraulioVM
BraulioVM / Screen.hs
Created October 30, 2016 15:42
Restricting IO effects
module Screen (Screen,
ScreenPosition,
moveCursor,
writePixel,
putPixel
) where
@BraulioVM
BraulioVM / gist:8097597
Last active January 1, 2016 05:19
C++ vector shuffler
vector<int> swap(int first_index, int second_index, vector<int> el_vector){
int auxiliar = el_vector[first_index];
el_vector[first_index] = el_vector[second_index];
el_vector[second_index] = auxiliar;
return el_vector;
}
class GeneradorPermutaciones {
private:
@BraulioVM
BraulioVM / natural.py
Created July 7, 2013 14:17
Axiomatic Construction of Natural Numbers in Python. No single number was used.
class Natural:
def __init__(self, predecesor = None):
self.predecesor = predecesor
def __eq__(self, otro):
# 0 = 0
# if n' = m', n = m
if self.isZero() or otro.isZero():
return self.isZero() == otro.isZero()
@BraulioVM
BraulioVM / gist:4666253
Created January 29, 2013 18:07
Haskell Peano
antecesor a = a - 1
sucesor a = a + 1
suma a 0 = a
suma a (n) = sucesor( suma a (antecesor n) )
def modificador(f):
def nueva_funcion():
return "Braulio es un " + f()
return nueva_funcion
@modificador
def crack():
return "crack"
crack() # Devuelve "Braulio es un crack"
def crack():
return "crack"
def modificador(f):
def nueva_funcion():
return "Braulio es un " + f()
return nueva_funcion
crack = modificador(crack)