b0nfire.xyz is a Fediverse instance that uses the ActivityPub protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.
This server runs the snac software and there is no automatic sign-up process.
Great, now the AI is throwing malware into python libraries, too.
Anthropic's Claude breached 3 orgs, uploaded PyPI malware during tests
I updated my #python library that downloads #audiobooks from Libro.fm
Besides updating things so it works with the API once more, I modified it to skip books that have already been downloaded. Yes, this is an obvious change.
I also added a `--force` option to redownload everything if you want to.
I keep running into tools created to help #AI agents, which provide features I want to have for humans. Only they aren't for us and would require extensive rework to be useful for us.
Why?
Here's an example: Indexes and searches a knowledge vault:
> wikimap – Built for AI coding assistants (Claude Code and friends) working against a knowledge vault: an Obsidian vault, a team wiki, a folder of specs, slides, and plans. https://github.com/dhha22/wikimap
Alas..
In the ongoing project that is slowly proving every facet of Murphys Law to be true..
The voice works
The servos work
The joystick works
Put it all together and..
The joystick takes over the sound and it crashes on voice.
I got options.. but still.. its getting almost to that moniacle laughing phase (eyetwitch).. lol..sigh..
Candidature rejetée, après deux entretiens, parce que l'entreprise «s'oriente vers une adoption forte de l'IA dans ses pratiques de développement, une direction qui ne semble pas alignée avec vos attentes à ce stade».
Est-ce qu'il y a encore des éditeurs de logiciels en France qui sont prêts à embaucher un développeur qui préfère écrire lui-même son code ?
NEW! Leanpub Book LAUNCH 🚀 Build Your Own RPG Dungeon Crawler in Python: A Complete Roguelike Tutorial by Mike Gold
#books #leanpublishing #selfpublishing #roguelike #Python #dungeoncrawler #gamedev #proceduralgenerationration
From the Leanpub Blog: Leanpub Book LAUNCH 🚀 Build Your Own RPG Dungeon Crawler in Python: A Complete Roguelike Tutorial by Mike Gold
#books #leanpublishing #selfpublishing #roguelike #Python #dungeoncrawler #gamedev #proceduralgenerationration
I'd like to do some "graphics" programming, but a specific type.
I want to display white dots on a black backround. Calculate a new set of dots, and spit them to the screen. Don't mind if I have to turn off old dots myself.
SBCL would be optimal, Python OK, C/C++ no thanks city.
Do any GUI toolkits support such a widget???
Any recommendations/experience doing this sort of thing???
Tell #Python to recite the powers of two in English
$ seq 1 16|while read n;do echo $((2**n));done|python3 -c "import sys,inflect;p=inflect.engine();[print(p.number_to_words(int(x.strip()))) for x in sys.stdin if x.strip()]"
Calculate pi to n digits with #python
#!/usr/bin/python3
from decimal import Decimal, getcontext
import sys
digits = int(sys.argv[1]) if len(sys.argv) > 1 else 50
getcontext().prec = digits + 5
def arctan(x):
x = Decimal(x)
x2 = x * x
term = Decimal(1) / x
total = term
n = 1
sign = -1
while True:
term = term / x2
delta = term / (2 * n + 1)
if delta == 0:
break
total += sign * delta
sign *= -1
n += 1
return total
pi = 16 * arctan(5) - 4 * arctan(239)
pi = +pi
print(f"Pi to {digits} digits:\n{str(pi)[:digits+2]}")
Build a random maze with #Python
#!/usr/bin/python3
from random import shuffle, randrange
def makemaze(w=20,h=12):
vis = [[0] * w + [1] for _ in range(h)] + [[1] * (w + 1)]
ver = [["| "] * w + ['|'] for _ in range(h)] + [[]]
hor = [["+--"] * w + ['+'] for _ in range(h + 1)]
def walk(x, y):
vis[y][x] = 1
d = [(x - 1, y), (x, y + 1), (x + 1, y), (x, y - 1)]
shuffle(d)
for (xx, yy) in d:
if vis[yy][xx]: continue
if xx == x: hor[max(y, yy)][x] = "+ "
if yy == y: ver[y][max(x, xx)] = " "
walk(xx, yy)
walk(randrange(w), randrange(h))
s = ""
for (a, b) in zip(hor, ver):
s += ''.join(a + ['\n'] + b + ['\n'])
return s
print(makemaze())
Find the intersection of two lines from four points with #linearalgebra under #Python
#!/usr/bin/env python3
import sys,numpy as n
p,q,r,s=map(n.array,((float(sys.argv[i]),float(sys.argv[i+1])) for i in (1,3,5,7)))
M=n.c_[q-p,s-r]
d=n.linalg.det(M)
if abs(d)<1e-10:
print("Coincident" if abs(n.cross(q-p,r-p))<1e-10 else "Parallel")
else:
t,_=n.linalg.solve(M,r-p)
print(p+t*(q-p))
Logical truth tables in #Python
#!/usr/bin/env python3
import sys
from itertools import product
bexp=" ".join(sys.argv[1:])
code=compile(bexp,"<string>","eval")
names=code.co_names
print("\n" + " ".join(names),":",bexp)
for values in product(range(2), repeat=len(names)):
env=dict(zip(names,values))
print(" ".join(map(str,values)),":",int(eval(code,env)))
#!/usr/bin/env python3
from datetime import*
t=datetime.today()
print("Only",(datetime(t.year,12,25)-t).days,"shopping days until Christmas.")
Plot a 3D sphere with #Python
#!/usr/bin/python3
import numpy as np
import matplotlib.pyplot as plt
theta, phi = np.linspace(0, 2 * np.pi, 50), np.linspace(0, np.pi, 20)
THETA, PHI = np.meshgrid(theta, phi)
R = 1.0
X = R * np.sin(PHI) * np.cos(THETA)
Y = R * np.sin(PHI) * np.sin(THETA)
Z = R * np.cos(PHI)
fig = plt.figure()
ax = fig.add_subplot(1,1,1, projection='3d')
plot = ax.plot_wireframe(X, Y, Z, rstride=1, cstride=1, linewidth=.1, color='red', antialiased=False, alpha=1)
plt.show()
Convert time in seconds to larger units with #Python:
#!/usr/bin/env python3
import sys
sec=int(sys.argv[1])
def dur(sec):
t=[]
for dm in (60,60,24,7):
sec, m=divmod(sec,dm)
t.append(m)
t.append(sec)
return ', '.join('%d %s' % (num,unit)
for num, unit in zip(t[::-1], 'wk d hr min sec'.split())
if num)
print ("%7d seconds = %s" % (sec,dur(sec)))
Invoke the Dark Lord with #Python using turtle graphics:
#!/usr/bin/env python3
import turtle
turtle.bgcolor("green")
t = turtle.Turtle()
t.color("red", "blue")
t.begin_fill()
for _ in range(5):
t.forward(200)
t.right(144)
t.end_fill()
t.hideturtle()
turtle.exitonclick()
Calculate the complete elliptic integral of the second kind with #Python (in this case the perimeter of the orbit of Mercury in AU):
#! /usr/bin/python3
import math
import sys
a = float(sys.argv[1])
b = float(sys.argv[2])
h = ((a - b) / (a + b))**2
eps = sys.float_info.epsilon
def binom_half(n):
coef = 1.0
for k in range(n):
coef *= (0.5 - k) / (k + 1)
return coef
perimeter = 0.0
n = 0
term = 1.0
while abs(term) > eps:
coef = binom_half(n)
term = (coef**2) * h**(2*n)
perimeter += term
n += 1
perimeter *= math.pi * (a + b)
print(f"Ellipse perimeter: {perimeter:.17f}")
print(f"Series converged after {n} terms")
Factors with #Python
#! /usr/bin/python3
from sys import*
from sympy.ntheory import factorint as f
for i in range(int(argv[1]),int(argv[2])+1):print(i,f(i,multiple=1))
Plot an ellipsoid with #Python
#! /usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
r = 10
u = np.linspace(0, 2 * np.pi, 100)
v = np.linspace(0, np.pi, 100)
x = r * np.outer(np.cos(u), np.sin(v))
y = r * np.outer(np.sin(u), np.sin(v))
z = r * np.outer(np.ones(np.size(u)), np.cos(v))
ax.plot_surface(x, y, z, color='linen', alpha=0.5)
theta = np.linspace(0, 2 * np.pi, 100)
z = np.zeros(100)
x = r * np.sin(theta)
y = r * np.cos(theta)
ax.plot(x, y, z, color='black', alpha=0.75)
ax.plot(z, x, y, color='black', alpha=0.75)
zeros = np.zeros(1000)
line = np.linspace(-10,10,1000)
ax.plot(line, zeros, zeros, color='black', alpha=0.75)
ax.plot(zeros, line, zeros, color='black', alpha=0.75)
ax.plot(zeros, zeros, line, color='black', alpha=0.75)
plt.show()
#Python Hypothesis package now requires #RustLang. This is a scale of reverse dependencies I can't handle. I guess this means it's the end of WD40 profiles on #Gentoo, and therefore the end of support for Alpha, ARM<v6, HPPA, M68k, i486 and some other random subsets of architectures and profiles. Thanks for all the fish, etc.
Python Quick Ref for JS Devs: A Side-by-Side ES6 & TypeScript to Python Reference by Samir Solanki is a new release on Leanpub!
Stop translating Python in your head. Compare ES6/TypeScript and Python side by side and start writing Python with confidence.
Link: https://leanpub.com/pythonquickref
#books #ebooks #newreleases #leanpublishing #selfpublishing #python #es6
heise+ | Die eigenen Lieblingsfilme durch paarweises Vergleichen herausfinden
Gefällt Ihnen Memento oder Heat besser? Unsere kleine Webanwendung findet durch paarweises Vergleichen statistisch Ihre Lieblingsfilme.
#Filme #IT #JavaScript #Python #Softwareentwicklung #Statistik #news
Area of any valid triangle with #Python
#!/usr/bin/python3
import sys, math
a, b, c = map(float, sys.argv[1:])
if a + b <= c or a + c <= b or b + c <= a:
print("Error: not a valid triangle")
sys.exit(1)
peri = a + b + c
area = math.sqrt((a + b + c) *
(a + b - c) *
(a - b + c) *
(-a + b + c)) / 4
print("Perimeter =", peri)
print("Area =", area)
Put text in an ASCII art box with #Python
#!/usr/bin/env python3
import sys
print("+" + "-" * 62 + "+")
for line in sys.stdin:
print(f"| {line.rstrip():<60} |")
print("+" + "-" * 62 + "+")
#Apollo and #Python. Ovide moralisé en prose, Bruges ca. 1470-1480. BnF, Français 137, fol. 8r.
#medieval #MedievalArt
Print all primes less than 5000 with #Python
python3 -c 'print([i for i in range(2,5000) if all(i%j for j in range(2,int(i**0.5)+1))])'