Skip to content

Instantly share code, notes, and snippets.

@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 6, 2025 16:19
advent6.1
input2="""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 / 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
@jul
jul / simple.py
Last active March 27, 2025 13:42
a web server that uses the HTML submitting a request as a model and create table on the fly if necessary
# MIGRATED HERE https://github.com/jul/pdca/blob/main/simple.py
# STDLIB
import multipart
from wsgiref.simple_server import make_server
from json import dumps
from html.parser import HTMLParser
from base64 import b64encode
from urllib.parse import parse_qsl, urlparse
import traceback
from http.cookies import SimpleCookie as Cookie
@jul
jul / tuner2.py
Last active October 29, 2024 13:20
a better guitar tuner in python
import pyaudio
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import time
from sys import argv
A = 440.0
try:
A=float(argv[1])
@jul
jul / anim_ps.py
Created October 23, 2024 08:57
making animation with the ghostscript interpreter
#!/usr/bin/env python3
# -*- coding: utf8 -*-
from subprocess import Popen, PIPE, STDOUT
import sys, os
from time import sleep
import select
from random import randint
MAXX=512
MAXY=512