Skip to content

Instantly share code, notes, and snippets.

View Player.clj
(ns Player
(:gen-class)
(:import (java.io StringReader)
(clojure.lang LineNumberingPushbackReader PersistentQueue))
(:use clojure.set))
;---------------------------------------------------------------
; _ _ _ _ _ _
; _ _| |_(_) (_) |_(_) ___ ___
View gcd.java
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();
}
View global-gitignore.md

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
View RPN.md

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 :

View al1.md

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)){
 ...
View arankscore.clj
(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
View docker.md

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 Oct 9, 2017
Tree traversal with tail call recursion
View tree.erl
-module(tree).
-export([main/0]).
-record(node, {
value = nil,
left = nil,
right = nil}).
%
% tc_pre_order
View shabits.erl
-module(shabits).
-author("Arnauld").
%% ------------------------------------------------------------------
%% API Function Exports
%% ------------------------------------------------------------------
-export([perimeter/1, area/1, enclose/1]).
-export([bits/1, bits_tailrec/1]).
View atom.sml
(* 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?