Skip to content

Instantly share code, notes, and snippets.

View emiflake's full-sized avatar
🌼
Petaline enjoyer

emiflake

🌼
Petaline enjoyer
  • Liqwid Labs
  • Amsterdam, The Netherlands
  • 14:47 (UTC +01:00)
View GitHub Profile
@emiflake
emiflake / decoders.u.hs
Created May 13, 2020 17:54
Monadic style JSON decoding with Unison Abilities!
expect! : Either e a -> {Exception e} a
expect! = cases
Left e -> raise e
Right a -> a
identity : Decode Value
identity =
Decode (v -> Right v)
(~>) : Value -> Text -> {Exception Text} Value
namespace RFC where
parseDigit = oneOfChars [?0, ?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9]
parseHex = Unipar.satisfy isHexDigit "wasn't a hex digit"
parseCRLF = (ch ?\r Unipar.>> ch ?\n)
type RawHeaders
= RawHeaders (Map Text Text)
type Request
= Request HostName Text RawHeaders
@emiflake
emiflake / Day05.kt
Last active December 5, 2019 16:30
import java.io.File
import java.util.stream.Stream
import kotlin.streams.toList
import kotlin.system.measureNanoTime
import kotlin.system.measureTimeMillis
sealed class IntCode {
abstract val steps: Int
object Halt : IntCode() {
// ==UserScript==
// @name Hide Blackhole
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://profile.intra.42.fr/users/*
// @match https://profile.intra.42.fr/
// @grant none
// ==/UserScript==
let mapleader=","
set nocompatible
filetype off
"let base16colorspace=256
set termguicolors
let g:loaded_matchit = 1
/* ************************************************************************** */
/* */
/* :::::::: */
/* gfx_keys.h :+: :+: */
/* +:+ */
/* By: nmartins <[email protected]> +#+ */
/* +#+ */
/* Created: 2019/04/30 00:56:56 by nmartins #+# #+# */
/* Updated: 2019/05/02 20:28:49 by nmartins ######## odam.nl */
/* */
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include "get_next_line.h"
#include "libft.h"
int main(int argc, char **argv)
{
" show line numbers
set number
" enable mouse support
set mouse=a
" enable ruler
set ruler
" set tabs to 4 spaces
set ts=4
set softtabstop=0 noexpandtab
set shiftwidth=4
#include <stdio.h>
#include <stdlib.h>
#include "libft.h"
size_t digit_mul(long long n)
{
size_t i;
i = n % 10;
n /= 10;
/* ************************************************************************** */
/* */
/* :::::::: */
/* libft.h :+: :+: */
/* +:+ */
/* By: nmartins <[email protected]> +#+ */
/* +#+ */
/* Created: 2019/02/26 15:29:41 by nmartins #+# #+# */
/* Updated: 2019/03/20 19:26:46 by nmartins ######## odam.nl */
/* */