Skip to content

Instantly share code, notes, and snippets.

View apelisse's full-sized avatar

Antoine Pelisse apelisse

  • OpenAI
  • San Francisco
View GitHub Profile
@apelisse
apelisse / merge.py
Last active December 3, 2021 19:03
Merging lists in Kubernetes SSA
#!/usr/bin/env python3
import unittest
def merge(a, b):
"""Merge 2 strings containing unique items into one final string
containing the same unique items. This tries to preserve the order
of the two lists if possible, but will prefer the order of the
second list if they disagree. New items will also appear after older
#include <limits>
struct Nil {
typedef int type;
};
template <int V, class L = Nil, class R = Nil> struct BTree {
typedef decltype(V) type;
static const type value = V;
typedef L left;
@apelisse
apelisse / Willow.cfg
Created June 16, 2014 19:17
This is from 2007, but who knows when I'll need it again ?
unbindall
// Affichage
//______________________________________
seta r_primitives "0"
seta r_railSegmentLength "0"
seta r_railCoreWidth "1"
seta r_railWidth "1"
/*
* Reads a word from standard input, and write the biggest palindrome it can
* from that word and only by removing letters.
* E.g. Biggest palindrome for "baobab" is "babab" (removing the "o").
*
* This is implemented using dynamic programming, that is searching the
* longest common subsequence (O(n²) time and space complexity) between the word,
* and it's reverse:
* i.e. LCS between "baobab" and "baboab"
*/
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
struct node {
struct node *left, *right, *parent;
int value;
};