Skip to content

Instantly share code, notes, and snippets.

@jul
jul / advent.py
Created December 17, 2025 13:04
advent day 9 part 2
#!/usr/bin/env python
input="""97652,50353
97652,51578
98177,51578
98177,52782
97848,52782
97848,54028
98180,54028
98180,55220
@jul
jul / advent.py
Created December 7, 2025 15:22
advent3.2
#!/usr/bin/env python
from functools import reduce
input="""987654321111111
811111111111119
234234234234278
818181911112111"""
input="""
4426546555433545424424345444644242452452532444564422646557424354153538454225332755435544545533324152
4325282447422434333445212333343451413231333423353426332541123254243232342322553322244341312543932333
@jul
jul / advent.py
Last active December 7, 2025 11:57
advent7
from archery import mdict
input="""
......................................................................S......................................................................
.............................................................................................................................................
......................................................................^......................................................................
.............................................................................................................................................
.....................................................................^.^.....................................................................
.............................................................................................................................................
....................................................................^...^..............................................................
@jul
jul / advent.py
Created December 6, 2025 14:57
advent6
input="""123 328 51 64
45 64 387 23
6 98 215 314
* + * +"""
import re
from functools import reduce
all= input.split("\n")
X = len(all)
Y=len(re.split(r"\s+", all[0].strip()))
@jul
jul / advent.py
Last active December 7, 2025 17:08
advent6.2
#!/usr/bin/env python
input="""5 679 21 1766 81 75 16 993 2897 28 534 9545 5 5922 63 6 732 569 579 727 63 57 931 1854 55 834 441 32 72 33 3 365 56 718 96 278 985 47 364 34 58 76 99 495 15 78 736 87 4324 456 361 42 3126 69 76 7994 533 31 67 8 176 2 14 623 6628 5 8 49 9114 6 96 35 725 994 87 37 34 8 367 8 697 778 34 96 8 7 911 194 684 97 75 829 37 2 369 526 35 62 57 9613 16 68 2 96 7 38 34 2 169 866 92 718 49 38 22 5 9 1 489 639 21 19 399 71 89 298 6 984 55 21 68 9 694 6 554 5 1398 4212 2272 35 48 55 46 5639 3 86 199 6 286 33 628 63 39 82 22 4 1 631 5 143 4595 859 811 31 6 459 5 863 3 475 22 7 179 72 461 76 679 57 8 6867 65 74 5931 31 494 77 6369 152 3 141 379 5791 99 3 678 33 245 92 66 774 86 3 2 17 3 33 187 6 58 23 483 365 19 4 46 767 289 39 74 8562 32 774 715 48 87 76 96 8 33 18 11 35 973 78 145 377 4 46 9655 64 321 56 1 779 95 716 388 6 28 578 31 68 5648 67 467 918 4 3 364 433 9 786 198 52 9
@jul
jul / advent4.py
Last active December 4, 2025 12:54
advent of code day4
class Matrix:
def __init__(self,size_x,size_y, mutable_sequence):
"""construct a view of a dimension x and y on mutable_sequence
the mutable_sequence must have a dimension compliant with its size
"""
self.size_y=size_y
self.pattern = [ ".", "@", "X" ]
self.size_x=size_x
@jul
jul / bake.sh
Created November 14, 2025 08:39
a template for a bash script à la make
#!/usr/bin/env bash
set -e
declare -a action;
RD='\e[31m'
GB='\e[33m'
BL='\e[34m'
RZ='\e[0m'
DEBUG=${DEBUG:-1}
ONE_VAR=${ONE_VAR:-template.dot}
@jul
jul / mr_freeze.sh
Last active November 12, 2025 14:39
a framework for comparing present scripts execution with past ouput
#!/usr/bin/env bash
# Licence : fait tout ce que tu veux excepter dire que tu l'as écrit ou repomper sans citer jul
usage() {
cat << NAN
# $0 (freeze|thaw|prior_result) input
Blogpost-documentation generated by using \`$0 usage \` as a way to
try to have all in one place ;)
Source here : [https://gist.github.com/jul/ef4cbc4f506caace73c3c38b91cb1ea2](https://gist.github.com/jul/ef4cbc4f506caace73c3c38b91cb1ea2)
@jul
jul / text.py
Last active August 9, 2025 14:16
text indexation
import json
import os
import sys
import spacy
from langdetect import detect
from archery import mdict, vdict
from time import time
import re
@jul
jul / fh.py
Last active July 1, 2025 08:56
trollmètre bluesky qui reposte sur le compte
#!/usr/bin/env python
#basé sur https://gist.github.com/stuartlangridge/20ffe860fee0ecc315d3878c1ea77c35
import json
import os
import sys
from atproto_client.models import get_or_create
from atproto import CAR, models, Client, client_utils
import requests
from atproto_firehose import FirehoseSubscribeReposClient, parse_subscribe_repos_message