Skip to content

Instantly share code, notes, and snippets.

View arnaudbos's full-sized avatar
😶‍🌫️

Arnaud Bos arnaudbos

😶‍🌫️
View GitHub Profile
++++++++++[>+++++++>++++++++++>+++++++++++>++++++++++++>+++>+++++++<<<<<<-]
>++.>---.>++..>+.>++.>-.<<<<.>+++.+.<++++.>--.>>.<<<+.>.---.--.>>.
<<<<+++++.>>++.-.<+++++.------.>>.<<<+++.>----.>>-----.<<++.>------.>>+.
@arnaudbos
arnaudbos / ∪_prob.clj
Last active March 25, 2018 00:26
Inclusion–Exclusion Principle for probabilities in Clojure.
(require '[clojure.math.combinatorics :refer [combinations]])
(defn ∩-prob
[a & more]
(reduce * a more))
(defn ∪-prob [a b & more]
"https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle#In_probability"
(let [ps (concat [a b] more)
n (count ps)]
@arnaudbos
arnaudbos / BinaryPropertyConverter.java
Last active February 12, 2018 09:40
Swagger binary and Codegen InputStream
package com.mycompany.myproject.resources.utils;
import com.fasterxml.jackson.databind.JavaType;
import io.swagger.converter.ModelConverter;
import io.swagger.converter.ModelConverterContext;
import io.swagger.models.Model;
import io.swagger.models.Xml;
import io.swagger.models.properties.Property;
import io.swagger.models.properties.StringProperty;
import io.swagger.util.Json;
The Boy Scouts have a rule: "Always leave the campground cleaner than you found it." If you find a mess on the ground, you clean it up
regardless of who might have made the mess. You intentionally improve the environment for the next group of campers. Actually the
original form of that rule, written by Robert Stephenson Smyth Baden-Powell, the father of scouting, was "Try and leave this world a
little better than you found it."
What if we followed a similar rule in our code: "Always check a module in cleaner than when you checked it out." No matter who the
original author was, what if we always made some effort, no matter how small, to improve the module. What would be the result?
I think if we all followed that simple rule, we'd see the end of the relentless deterioration of our software systems. Instead, our
systems would gradually get better and better as they evolved. We'd also see teams caring for the system as a whole, rather than just
@arnaudbos
arnaudbos / README
Created July 13, 2016 08:30
Ignoring locally-generated files
If you don't want to create a .gitignore file to share with others, you can
create rules that are not committed with the repository. You can use this
technique for locally-generated files that you don't expect other users to
generate, such as files created by your editor.
Use your favorite text editor to open the file called .git/info/exclude
within the root of your Git repository. Any rule you add here will not be
checked in, and will only ignore files for your local repository.
@arnaudbos
arnaudbos / localserv.py
Last active May 27, 2016 06:55
Python Simple HTTP Server with Upload + CORS
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@arnaudbos
arnaudbos / guerilla_open_access_manifesto_en.txt
Created November 26, 2015 10:53
Guerilla Open Access Manifesto - Multilingual
Guerilla Open Access Manifesto
Information is power. But like all power, there are those who want to keep it for
themselves. The world's entire scientific and cultural heritage, published over centuries
in books and journals, is increasingly being digitized and locked up by a handful of
private corporations. Want to read the papers featuring the most famous results of the
sciences? You'll need to send enormous amounts to publishers like Reed Elsevier.
There are those struggling to change this. The Open Access Movement has fought
valiantly to ensure that scientists do not sign their copyrights away but instead ensure
@arnaudbos
arnaudbos / todo_app.cljs
Last active August 29, 2015 14:16
should-component-update with vector
(ns todomvc
(:require [reagent.core :as reagent :refer [atom]]))
(defonce todos (atom (sorted-map)))
(defonce counter (atom 0))
(defn add-todo [text]
(let [id (swap! counter inc)]
(swap! todos assoc id {:id id :title text :done false})))
@arnaudbos
arnaudbos / supervisord.sh
Created March 13, 2014 09:37
supervisord init
#! /bin/sh
#
# skeleton example file to build /etc/init.d/ scripts.
# This file should be used to construct scripts for /etc/init.d.
#
# Written by Miquel van Smoorenburg <[email protected]>.
# Modified for Debian
# by Ian Murdock <[email protected]>.
# Further changes by Javier Fernandez-Sanguino <[email protected]>
#
@arnaudbos
arnaudbos / clojure.core.clj
Last active August 29, 2015 13:56
clojure partition-with
(defn partition-with
[f coll]
{:pre [(fn? f) (coll? coll)]}
(let [coll (partition-by f coll)
coll (partition 2 coll)
coll (map #(concat (first %) (second %)) coll)
]
coll))
(defn partition-on