Skip to content

Instantly share code, notes, and snippets.

@ssimono
ssimono / partial-track.py
Last active December 4, 2022 22:26
Partial file tracking script
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from json import load, dump
from re import search
from subprocess import run, PIPE
from sys import exit
from textwrap import dedent
import hashlib
def _git_update_index(skip_worktree, file_path):
@ssimono
ssimono / splittypie-csv-export.js
Created July 22, 2022 22:13
Export the expenses of a Splittypie event into CSV. Runs on the browser only.
/**
* Usage: Copy this entire snippet and paste it into the developer console.
* A link will appear on the top just above the event title (on Desktop view).
* Just click it to get a CSV containing the expenses.
*
* Please double-check the result as this is made via frontend scrapping and
* can therefore miss edge cases or break upon future changes in the document
* structure.
*/
@ssimono
ssimono / icecream.py
Last active April 25, 2023 10:02
Diego's Puzzle
"""
Problem:
An icecream vendor starts her shift with an empty box of change. She sells icecreams for 5€ per unit.
Customers show up one by one and pay with bills of either 5€, 10€, 20€ or 50€.
Depending on the order of customers and the bills they give, she might or might not become unable to process a transaction at some point.
Task: write a function icecream that takes an array of integers representing the suite of bills that each customer gives.
The function must return a boolean that indicates whether the seller can fullfil all customers purchases.
"""
import unittest
@ssimono
ssimono / autosnake.py
Created November 16, 2020 20:54
Snake that plays by itself. AI far from singularity
from collections import deque
from enum import Enum
from functools import lru_cache
from random import randint
from sys import stderr
from time import sleep
from typing import Generator, Iterable, NamedTuple
MAP_WIDTH = 30
MAP_HEIGHT = 30

Keybase proof

I hereby claim:

  • I am ssimono on github.
  • I am ssimono (https://keybase.io/ssimono) on keybase.
  • I have a public key whose fingerprint is F09F 5E37 2186 27B5 904E EBB7 154E 4E82 E84C 8DD0

To claim this, I am signing this object:

@ssimono
ssimono / pre-commit
Created July 7, 2016 07:28
Pre commit hook for checking go source conventions usage
#!/bin/bash
# This pre hook runs all go checking tools on every relevant go file.
# Returns status 1 if checks fail, preventing commit to be done
function fmtdiff {
gofmt -d $@ > /tmp/gofmtdiff
if [ `wc -l < /tmp/gofmtdiff` != 0 ]; then
cat /tmp/gofmtdiff
echo "Run gofmt to apply those changes"