Skip to content

Instantly share code, notes, and snippets.


Stefano Rivera stefanor

View GitHub Profile
stefanor /
Created Aug 14, 2020
Python fragment, mirroring repos from GitHub with pygithub3
repos = gh.repos.list_by_org(
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):
stefanor / bt
Last active May 24, 2020
disas of cyrus-imapd's crc32_slice8
View bt
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 CSV')
View nicesigs.txt
"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
stefanor /
Created Aug 24, 2017
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 /
Last active Sep 2, 2016
buffering demo
#!/usr/bin/env python3
import difflib
import subprocess
import sys
qty = 1000000
seq = subprocess.check_output(
('seq', str(qty))).decode('utf-8')
View gist:5fbd45c4a68351720be72ff898568e9a
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|" \
View dpmt renames
# 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),
#!/usr/bin/env python
import argparse
import logging
import platform
import subprocess
import time
import requests
from requests.exceptions import ConnectionError, ReadTimeout
You can’t perform that action at this time.