Skip to content

Instantly share code, notes, and snippets.

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