Skip to content

Instantly share code, notes, and snippets.

@rtobar
rtobar / update-a-313.rst
Last active November 19, 2024 04:02
Notas acerca de transición a 3.13

Notas

  1. Seguí las instrucciones en .overrides/update-python-version.rst
  2. En la instrucción acerca de hacer el update del submódulo de cpython usé el hash a86632f7ea8cc77af770b33f60124ca767698c7, que era el último commit en la rama 3.13. Ya pasaron varios días ya, así que está viejito. El último commit en esa rama al escribir esto este texto es c2c18acc3db031647fce06c4e1701ec0303e309c.
  3. Usé Python 3.11, que es lo que estamos usando en CI también, para no introducir más variables al proceso.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# This script requires the changes in https://github.com/casacore/casacore/pull/1116,
# which as of 14/Jul/2021 haven't been merged upstream yet
import functools
import operator
import os
import sys
import time
import casacore.tables as tables
@rtobar
rtobar / memprof.py
Last active September 26, 2020 02:19
import gc
import os
import resource
import sys
import time
def memusage():
"""memory usage in MB. getrusage defaults to KB on Linux."""
return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1e3
# coding: utf-8
from __future__ import print_function
import resource
import gc
import time
import six
# set IJSON_BACKEND=yajl2_c or yajl2_cffi
@rtobar
rtobar / capicuas.cpp
Last active February 11, 2020 02:48
//
// Compilacion: Como el usuario lo estime conveniente.
// Si se define HAVE_GMP entonces hay que linkear contra libgmp y libgmpxx, e.g.:
//
// $> CXXFLAGS="-Wall -O3 -DHAVE_GMP" LDLIBS="-lgmp -lgmpxx" make capicuas
//
// Uso: ./capicuas
// ./capicuas <primer-numero> <ultimo-numero>
// ./capicuas <primer-numero> <ultimo-numero> <precision>
// ./capicuas <primer-numero> <ultimo-numero> <precision> <max-iteraciones>
from collections import Counter
import string
import sys
def factores_primos(n):
factor = 2
while n >= 2:
if n % factor:
factor += 1
else:
import hashlib
import sys
hashes = [line.strip() for line in sys.stdin.readlines()]
for i in range(10000):
digest = hashlib.sha512('%04d' % i).hexdigest()
if digest in hashes:
print(digest, '%04d' % i)
# $> python cracker.py < hashes.txt