Skip to content

Instantly share code, notes, and snippets.

View mgedmin's full-sized avatar

Marius Gedminas mgedmin

View GitHub Profile
@mgedmin
mgedmin / gist:6339f8cf91f74e84026c
Created May 27, 2015 11:04
virtualenv 13.0.1 fails with python3.5
mg@platonas: ~ $ virtualenv -p ~/python3.5/bin/python3.5 /tmp/wtf
Running virtualenv with interpreter /home/mg/python3.5/bin/python3.5
Traceback (most recent call last):
File "/home/mg/.venv/lib/python2.7/site-packages/enum/__init__.py", line 371, in __getattr__
return cls._member_map_[name]
KeyError: '_convert'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |vb|
@mgedmin
mgedmin / gist:357900cbfcb75b051f0a
Created May 19, 2015 06:22
Probable cause of winbot's recent bootstrap errors
Python 2.7.8 (default, Oct 20 2014, 15:05:19)
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> r = urllib.urlopen('https://pypi.python.org/packages/source/z/zc.buildout/zc.buildout-2.3.1.tar.gz')
>>> d = r.read()
>>> len(d)
292209
>>> r = urllib.urlopen('https://pypi.python.org/packages/source/z/zc.buildout/zc.buildout-2.3.1.tar.gz#md5=cbf008369ca28814ed8051084622fba8')
>>> d = r.read()
mg@platonas: ~/src/zopefoundation/zc.zodbdgc [git:(cff0f45...)] $ detox
py26 create: /home/mg/src/zopefoundation/zc.zodbdgc/.tox/py26
GLOB sdist-make: /home/mg/src/zopefoundation/zc.zodbdgc/setup.py
py27 create: /home/mg/src/zopefoundation/zc.zodbdgc/.tox/py27
py32 create: /home/mg/src/zopefoundation/zc.zodbdgc/.tox/py32
py33 create: /home/mg/src/zopefoundation/zc.zodbdgc/.tox/py33
py34 create: /home/mg/src/zopefoundation/zc.zodbdgc/.tox/py34
pypy create: /home/mg/src/zopefoundation/zc.zodbdgc/.tox/pypy
pypy3 create: /home/mg/src/zopefoundation/zc.zodbdgc/.tox/pypy3
py27 inst: /home/mg/src/zopefoundation/zc.zodbdgc/.tox/dist/zc.zodbdgc-0.6.2.dev0.zip
@mgedmin
mgedmin / multiping.py
Last active May 20, 2020 17:05
ping a host once a second and visualize the results
#!/usr/bin/python
"""
Multiping version ${version} by Marius Gedminas <[email protected]>
Licence: GPL v2 or later
Syntax: multiping hostname
Pings a host every second and displays the results in an ncurses window.
Legend:
# ping OK
@mgedmin
mgedmin / gist:d6d271f4ee6ae82d9a86
Created March 5, 2015 07:32
Jenkins groovy script to print scheduling rules for all the jobs
import hudson.triggers.*;
for (item in Jenkins.instance.getItems(Project)) {
println("--- Scheduling for " + item.name + " ---")
def trigger = item.triggers.get(Jenkins.instance.getDescriptor(TimerTrigger.class));
if (trigger) {
println trigger.spec;
}
}
@mgedmin
mgedmin / gist:391acd3828424e856d0c
Last active August 29, 2015 14:16
Fix for https://github.com/mgedmin/zodbbrowser/issues/12 and another issue I haven't filed yet
--- /srv/zopes/akl-2.13/eggs/zodbbrowser-0.12.0-py2.6.egg/zodbbrowser/browser.py.orig 2015-02-27 16:40:42.000000000 +0200
+++ /srv/zopes/akl-2.13/eggs/zodbbrowser-0.12.0-py2.6.egg/zodbbrowser/browser.py 2015-02-27 17:08:21.000000000 +0200
@@ -92,6 +92,9 @@
def __call__(self):
try:
return self.render()
+ except:
+ import traceback; traceback.print_exc()
+ import pdb; pdb.post_mortem()
finally:
$ fab -f a.py doit
THE THING

Done.
@mgedmin
mgedmin / fabfile.py
Last active September 6, 2019 05:59
Example of multiple environments in Fabric 1.x
from fabric.api import env, task, sudo
@task
def staging():
env.hosts.append('staging.example.com')
@task
def production():
env.hosts.append('production.example.com')
@mgedmin
mgedmin / rest.vim
Last active August 29, 2015 14:11
ReStructuredText for vim by @mgedmin
" Vim syntax file
" Language: reStructuredText Documentation Format
" Maintainer: Estienne Swart
" URL: http://www.sanbi.ac.za/~estienne/vim/syntax/rest.vim
" Latest Revision: 2004-04-26
"
" A reStructuredText syntax highlighting mode for vim.
" (derived somewhat from Nikolai Weibull's <source@p...>
" source)
"