Skip to content

Instantly share code, notes, and snippets.

@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
@jul
jul / ploter.py
Last active October 17, 2024 17:20
using python with tk directly and matplotlib to plot 3D functions
from time import time, sleep
from subprocess import Popen, PIPE
import os
import matplotlib.pyplot as plt
import numpy as np
from numpy import *
import select
from matplotlib import cm
# let's talk to tk/tcl directly
@jul
jul / gof_pertubed.py
Last active October 14, 2024 13:03
evaluating if an hexagonal patterned game of life can be used as a PRNG (spoiler : NO)
from time import time, sleep
import select
from subprocess import Popen, PIPE
from random import randint
import random
from os import system
import os
ORD=0
@jul
jul / gof_triangular.py
Last active October 11, 2024 10:25
triangular game of life with settable rules
from time import time, sleep
import select
from subprocess import Popen, PIPE
import os
from operator import itemgetter
SZ=15
DIMX=50
DIMY=50
SSP=80
@jul
jul / wall_clock_2.py
Last active October 6, 2024 10:48
howto to do bi directionnal python + tcl/tk without tkinter
#!/usr/bin/env python
from subprocess import Popen, PIPE
from time import sleep, time, localtime
import fcntl
import os
# let's talk to tk/tcl directly through p.stdin
p = Popen(['wish'], stdin=PIPE, stdout=PIPE)
fd = p.stdout.fileno()
@jul
jul / wall_clock.py
Last active October 4, 2024 22:24
howto do tk with python without tkinter : a wall clock in python + tcl/tk
#!/usr/bin/env python
from subprocess import Popen, PIPE
from time import sleep, time, localtime
# let's talk to tk/tcl directly through p.stdin
p = Popen(['wish'], stdin=PIPE)
def puts(s):
for l in s.split("\n"):
p.stdin.write((l + "\n").encode())
@jul
jul / matrix.py
Last active August 29, 2024 00:25
matrix as a view on a linear array
class DimensionError(Exception):
pass
class matrix(object):
def __eq__(self, tocomp):
other=tocomp
if type(tocomp) != type(self):
other=matrix(tocomp)
return (self.__val__, self.dim) == (other.__val__, other.dim)