Skip to content

Instantly share code, notes, and snippets.

View mcepl's full-sized avatar

Matěj Cepl mcepl

View GitHub Profile
@mcepl
mcepl / logcat.txt
Created February 5, 2014 11:08
output of abd logcat to evidence memory crash of Podcast
--------- beginning of /dev/log/system
I/Vold ( 123): Vold 2.1 (the revenge) firing up
D/Vold ( 123): Volume sdcard state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 123): Volume emmc state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 123): Volume sdcard state changing 0 (No-Media) -> 2 (Pending)
D/Vold ( 123): Volume sdcard state changing 2 (Pending) -> 1 (Idle-Unmounted)
W/Vold ( 123): Duplicate state (1)
W/Vold ( 123): Duplicate state (1)
W/Vold ( 123): Duplicate state (1)
W/Vold ( 123): Duplicate state (1)
@mcepl
mcepl / steps_tutorial.py
Created June 19, 2014 09:31
Most simple behave testing setup (according to https://pythonhosted.org/behave/tutorial.html)
from behave import *
@given('we have behave installed')
def step_impl(context):
pass
@when('we implement a test')
def step_impl(context):
assert True is not False
@mcepl
mcepl / gist:3bc960502645097f412a
Created September 15, 2014 13:22
Fix unicode crash in behave
--- a/behave/model.py
+++ b/behave/model.py
@@ -1203,7 +1203,7 @@ class Step(BasicStatement, Replayable):
if capture:
# -- CAPTURE-ONLY: Non-nested step failures.
if runner.config.stdout_capture:
- output = runner.stdout_capture.getvalue()
+ output = runner.stdout_capture.getvalue().encode('utf_8')
if output:
error += '\nCaptured stdout:\n' + output
#!/usr/bin/python
import re
import logging
import sys
import email
import time
from collections import OrderedDict as odict
logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s',
level=logging.INFO)
Mock Version: 1.1.16
Mock Version: 1.1.16
ENTER do(['bash', '--login', '-c', 'rpmbuild -bs --target s390 --nodeps builddir/build/SPECS/telegram-purple.spec'], False, '/var/lib/mock/rhel-7.2-build-2673211-1277730/root/', None, 86400, True, False, 498, 135, None, logger=<mockbuild.trace_decorator.getLog object at 0x94baefd0>)
Executing command: ['bash', '--login', '-c', 'rpmbuild -bs --target s390 --nodeps builddir/build/SPECS/telegram-purple.spec']
Building target platforms: s390
Building for target s390
Wrote: /builddir/build/SRPMS/telegram-purple-1.0.0-0.0.MC.1.vcs20150525.el7.src.rpm
warning: Could not canonicalize hostname: s390-014.build.bos.redhat.com
Child returncode was: 0
LEAVE do -->
var Response = require('ringo/webapp/response').Response;
var log = require('ringo/logging').getLogger(module.id);
var config = require("config");
function matchesREkey (obj, path) {
log.info("obj = " + obj.toSource());
log.info("path = " + path);
for (var key in obj) {
if (new RegExp(key).test(path)) {
return true;
@mcepl
mcepl / gist:891295
Created March 28, 2011 21:13
Demand OpenID on the current (or other) page
CmdUtils.CreateCommand({
names: ["demand"],
description: "Demand OpenID to be used for the current page",
author: {
name: "Matej Cepl",
email: "mcepl@redhat.com"
},
license: "MIT/X11",
icon: "http://www.mozilla.com/favicon.ico",
arguments: [{
@mcepl
mcepl / gist:891100
Created March 28, 2011 19:27
Ubiquity shorten URL
"use strict";
function getShortURL(which, args) {
var baseURL = ""; var params = {};
if (which == "is.gd") {
baseURL = "http://is.gd/create.php";
params = {
format: "simple",
url: encodeURIComponent(args.object.text)
root@bradford ~]# npm install -g libxml-to-js |&tee /tmp/npm-install-log.txt
> libxmljs@0.4.2 preinstall /usr/lib/node_modules/libxml-to-js/node_modules/libxmljs
> make node
scons: Reading SConscript files ...
Checking for node.js ...(cached) yes
True
Checking for C++ library xml2... yes
Checking for node.js ...(cached) yes
info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install', '-g', 'fibers@0.5' ]
info using npm@1.0.26
info using node@v0.4.11
verbose /usr/bin/node node symlink
verbose config file /root/.npmrc
verbose config file /usr/etc/npmrc
silly exec /usr/bin/node "/usr/lib/nodejs/npm/bin/npm-get-uid-gid.js" "nobody" 0
silly output from getuid/gid {"uid":99,"gid":0}
silly output from getuid/gid