Skip to content

Instantly share code, notes, and snippets.

View stefanor's full-sized avatar

Stefano Rivera stefanor

View GitHub Profile
@stefanor
stefanor / pip-22.3.1.log
Last active January 20, 2023 17:14
pip - Debian Bug 1019293 Example
Installed /usr/local/lib/python3.11/dist-packages/pip-22.3.1-py3.11.egg
Processing dependencies for pip==22.3.1
Finished processing dependencies for pip==22.3.1
root@leading-rhino:/tmp/pip# cd
root@leading-rhino:~# ls
root@leading-rhino:~# pip install -vv --user dbus-python==1.3.2
Using pip 22.3.1 from /usr/local/lib/python3.11/dist-packages/pip-22.3.1-py3.11.egg/pip (python 3.11)
User install by explicit request
Created temporary directory: /tmp/pip-build-tracker-_4k7kix3
Initialized build tracking at /tmp/pip-build-tracker-_4k7kix3
@stefanor
stefanor / mirror.py
Created August 14, 2020 19:03
Python fragment, mirroring repos from GitHub with pygithub3
repos = gh.repos.list_by_org(args.org).all()
for repo in repos:
log.debug("Mirroring %s", repo.full_name)
dirname = os.path.join(args.basedir, '%s.git' % repo.full_name)
userdir = os.path.dirname(dirname)
if not os.path.exists(userdir):
os.mkdir(userdir)
@stefanor
stefanor / bt
Last active May 24, 2020 18:57
disas of cyrus-imapd's crc32_slice8
Program terminated with signal SIGBUS, Bus error.
#0 crc32_slice8 (prev=1389039116, data=0xf4bce9f5, length=21) at lib/crc32.c:646
646 uint32_t one = *current++ ^ crc;
(gdb) bt
#0 crc32_slice8 (prev=1389039116, data=0xf4bce9f5, length=21) at lib/crc32.c:646
#1 0xf7938124 in crc32 (prev=2905928179, data=0xf4bce9f5, length=21) at lib/crc32.c:756
#2 0xf79381a2 in crc32_iovec (iov=0xffae1bbc, iovcnt=3) at lib/crc32.c:771
#3 0xf792511c in write_record (db=0x21df798, record=0xffae1c28, key=0x220c1c8 "aden.ado.ahabfirm",
val=0xf4bce9f5 <error: Cannot access memory at address 0xf4bce9f5>) at lib/cyrusdb_twoskip.c:800
#4 0xf792523e in append_record (db=0x21df798, record=0xffae1c28, key=0x220c1c8 "aden.ado.ahabfirm",
#!/usr/bin/env python3
import argparse
import csv
def main():
p = argparse.ArgumentParser()
p.add_argument('input', type=argparse.FileType('r'),
help='Input Ti.to CSV')
"Computers are useless; they can only give you answers." - Pablo Picasso
"Emacs is a nice operating system, but I prefer UNIX." - Tom Christiansen
"Never underestimate the bandwidth of a station wagon filled with backup-tapes." - Linus Torvalds
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had." - Linus Torvalds
"The Net interprets censorship as damage and routes around it." - John Gilmore
"The cheapest, fastest and most reliable components of a computer system are those that aren't there." - Gordon Bell
"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies and the other is to make it so complicated that there are no obvious deficiencies." - C A R Hoare
"Unix is simple, but it takes a genius to understand the simplicity." - Dennis Ritchie
A
@stefanor
stefanor / local_test.py
Created August 24, 2017 16:40
local testing of lintreview
#!/usr/bin/env python
import argparse
import logging
from lintreview import git
from lintreview.config import load_config, build_review_config
from lintreview.github import get_lintrc, get_repository
from lintreview.repo import GithubRepository
from lintreview.processor import Processor
#!/usr/bin/env python
from __future__ import print_function
import codecs
import sys
encoding = getattr(sys.stdout, 'encoding', '')
if encoding in (None, 'ANSI_X3.4-1968'):
UTF8Writer = codecs.getwriter('utf8')
@stefanor
stefanor / demo.py
Last active September 2, 2016 21:01
buffering demo
#!/usr/bin/env python3
import difflib
import subprocess
import sys
qty = 1000000
seq = subprocess.check_output(
('seq', str(qty))).decode('utf-8')
cd /dev/shm
git clone --single-branch ~/git/yola/sitebuilderui
git remote rm origin
git update-ref -d refs/tags/pre-template-component-purge
git filter-branch --index-filter '
git ls-files -s \
| sed "s|\t.*/nabtext\.js$|\tnabtext/nabtext.js|" \
# final_package, package, min_rev, max_rev
('python-pysnmp4', 'pysnmp', None, 278),
('python-pysnmp4', 'pysnmp4', 279, 513),
('python-pysnmp4', 'python-pysnmp4', 514, None),
('genshi', 'markup', None, 1463),
('genshi', 'genshi', 1464, None),
# Not actually a rename, but python-cherrypy is gone
('cherrypy3', 'python-cherrypy', None, 1646),
('cherrypy3', 'cherrypy3', 1647, None),
('python-decorator', 'decorator', None, 2111),