Skip to content

Instantly share code, notes, and snippets.

def settle_expenses(balances):
# balances : dict person -> solde (positif = on lui doit)
creditors = [(p, round(a,2)) for p,a in balances.items() if a>0]
debtors = [(p, round(a,2)) for p,a in balances.items() if a<0]
# sort crediteurs décroissants, débiteurs croissants par valeur absolue
creditors.sort(key=lambda x: x[1], reverse=True)
debtors.sort(key=lambda x: x[1]) # plus négatif d'abord
i, j = 0, 0
transactions = []
@cboully
cboully / Scottish_Shortbread.org
Last active May 11, 2025 15:56
Recettes pâtisserie

Scottish Shortbread

Video: How to Make Scottish Shortbread

Ingredients

  • 2 ¼ sticks/225g butter
  • Tiny pinch of salt
  • ½ cup/110g fine/caster sugar, plus extra for sprinkling
  • 2 cups/225g all-purpose/plain flour, plus extra for dusting
@cboully
cboully / compile_rofi.sh
Last active June 20, 2023 05:41
compile rofi in ubuntu 22.04
git clone --depth=1 --single-branch --branch 1.7.5 https://github.com/davatorium/rofi.git
git submodule update --init
sudo apt install bison flex libxcb-xkb-dev libxkbcommon-x11-dev \
libxcb-ewmh-dev libxcb-icccm4-dev libxcb-xrm-dev libxcb-xinerama0-dev \
libstartup-notification0-dev libmpdclient-dev libxcb-randr0-dev \
libxcb-cursor-dev doxygen cppcheck ohcount go-md2man meson
meson setup build
#Building emacs in ubuntu 24.04
sudo apt install build-essential \
gcc-11 \
g++-11 \
libgtk-3-dev \
libgnutls28-dev \
texinfo gnutls-bin \
libxpm-dev \
libgif-dev \
libncurses-dev \
@cboully
cboully / emacs.org
Last active October 5, 2022 13:18
cheasheet org mode

Buffer

  • (find-file) C-x C-f

Open file FILENAME.

  • (find-file-at-point)

Open file with filename under point

@cboully
cboully / permutation.py
Last active June 1, 2022 14:06
Python snippet
def split(word):
return [char for char in word]
def permutate(lin, lout):
if not lin:
print (''.join(lout))
for x in range(len(lin)):
#recursively call permutate after removing the current item, and add it the output
@cboully
cboully / emacs27.sh
Last active June 17, 2023 17:34 — forked from atgmello/emacs27.sh
Install Emacs 27 from source in Ubuntu 20.04 LTS
cd
git clone --depth=1 --single-branch \
--branch emacs-27 https://github.com/emacs-mirror/emacs.git
cd emacs/
sudo apt install -y autoconf make gcc texinfo libgtk-3-dev libxpm-dev \
libjpeg-dev libgif-dev libtiff5-dev libgnutls28-dev libncurses5-dev \
libjansson-dev libharfbuzz-dev libharfbuzz-bin imagemagick \