Skip to content

Instantly share code, notes, and snippets.

Avatar

Florian Schulze fschulze

View GitHub Profile
View LICENSE
MIT License
Copyright (c) 2020 Florian Schulze
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
View reset_mirror_names.py
from devpi_server.log import threadlog as log
from devpi_server.main import get_pluginmanager
from devpi_server.main import _main
import sys
def main():
pm = get_pluginmanager()
pm.register(Plugin())
_main(pm, sys.argv)
View reindex_root_pypi.py
from devpi_common.types import ensure_unicode
from devpi_server.log import threadlog as log
from devpi_server.main import get_pluginmanager
from devpi_server.main import _main
from devpi_web.indexing import preprocess_project
from devpi_web.main import get_indexer
import sys
import time
View db_compaction.py
from devpi_server.main import get_pluginmanager
from devpi_server.main import _main
import sys
def main():
pm = get_pluginmanager()
pm.register(Plugin())
_main(pm, sys.argv)
@fschulze
fschulze / .coveragerc
Last active Jul 15, 2018
coverage.py issue #678
View .coveragerc
[run]
plugins =
chameleon_coverage_plugin
@fschulze
fschulze / devpi-pypi-warehouse.sh
Created Mar 18, 2018
Create a devpi index for the new pypi.org (Warehouse)
View devpi-pypi-warehouse.sh
devpi index -c root/warehouse type=mirror "mirror_web_url_fmt=https://pypi.org/project/{name}/" "mirror_url=https://pypi.org/simple/" title=Warehouse
View iOS-32bit-finder.py
# run in a temporary folder to list 32 bit only iOS apps from your iTunes Library
from glob import glob
import os
import plistlib
import subprocess
import textwrap
import zipfile
ipas = glob(os.path.expanduser('~/Music/iTunes/Mobile Applications/*.ipa'))
@fschulze
fschulze / failed_tests
Created Oct 31, 2016
Filters failed tests from zope.testrunner output to be suitable for ```-t $(failed_tests)```
View failed_tests
#!/usr/bin/env python
import subprocess
def get_tests_from_paste_buffer():
return subprocess.check_output('pbpaste')
def run():
raw_tests = get_tests_from_paste_buffer()
View main.py
from pkg_resources import resource_filename
from pyramid.events import subscriber
from pyramid.events import BeforeRender
def devpiserver_cmdline_run(xom):
# this is slightly hacky, because accessing the command line args like that
# is not part of the official API, but this is just for convenience
if xom.config.args.theme is None:
xom.config.args.theme = resource_filename('devpi_example_theme', 'theme')
View gist:aca6e098b714951d7f43
import datetime
import pytz
def testcase(tzinfo, dt, delta):
dt = dt.replace(tzinfo=tzinfo)
earlier = dt - delta
later = earlier + delta
assert dt == later