Skip to content

Instantly share code, notes, and snippets.

View Arnauld's full-sized avatar
🐻‍❄️

Arnauld Loyer Arnauld

🐻‍❄️
View GitHub Profile
@Arnauld
Arnauld / Player.clj
Created June 3, 2021 15:04
Platinum Rift
(ns Player
(:gen-class)
(:import (java.io StringReader)
(clojure.lang LineNumberingPushbackReader PersistentQueue))
(:use clojure.set))
;---------------------------------------------------------------
; _ _ _ _ _ _
; _ _| |_(_) (_) |_(_) ___ ___
private static int gcd(int a, int b) {
BigInteger b1 = BigInteger.valueOf(a);
BigInteger b2 = BigInteger.valueOf(b);
BigInteger gcd = b1.gcd(b2);
return gcd.intValue();
}
@Arnauld
Arnauld / global-gitignore.md
Created May 29, 2019 09:21 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore

Context

An RPN calculator computes expressions written in Reverse Polish Notation.

An RPN expression or postfix expression is one of the following :

  • a number X, in wich case the value of the expression is that of X,
  • a sequence of form E1 E2 OP where E1 and E2 are RPN expressions and OP is an arithmetic operation.

Samples :

GR1

  • CLI: mauvaise gestion --help; privilégiez un contains plutôt qu'un args.length==1
  • Déclaration des types List<Operator> ... plutôt que ArrayList<Operator> ...
  • Dommage de pas avoir fait une classe Operators, qui aurait pu contenir la recherche du bon operateur plutôt que la boucle for dans la classe Calculator
for(Operator operator : operations){
    if(token.equals(operator.symbol)){
 ...
(ns aranks.core
(:require [clojure.java.io :as io])
(:import [org.yaml.snakeyaml Yaml]))
(defn- class-loader
"Return the current classloader"
^ClassLoader []
(.getContextClassLoader (Thread/currentThread)))
(defn list-resources
@Arnauld
Arnauld / docker.md
Last active February 23, 2018 11:16

Log docker sur MAC

$ cat /etc/asl/com.docker.daemon
# logging for Docker Engine
#
> /var/log/docker.log mode=0640 compress format=std rotate=seq file_max=5M all_max=20M
? [CA= Sender Docker] claim only
* file /var/log/docker.log
@Arnauld
Arnauld / tree.erl
Last active October 9, 2017 19:12
Tree traversal with tail call recursion
-module(tree).
-export([main/0]).
-record(node, {
value = nil,
left = nil,
right = nil}).
%
% tc_pre_order
-module(shabits).
-author("Arnauld").
%% ------------------------------------------------------------------
%% API Function Exports
%% ------------------------------------------------------------------
-export([perimeter/1, area/1, enclose/1]).
-export([bits/1, bits_tailrec/1]).
(* atom.sml
*
* COPYRIGHT (c) 1996 by AT&T Research
*
* AUTHOR: John Reppy
* AT&T Bell Laboratories
* Murray Hill, NJ 07974
* jhr@research.att.com
*
* TODO: add a gensym operation?