Skip to content

Instantly share code, notes, and snippets.

View yarikoptic's full-sized avatar
😠
Pseudo-"Tsar"-made WAR in Europe!

Yaroslav Halchenko yarikoptic

😠
Pseudo-"Tsar"-made WAR in Europe!
View GitHub Profile
@yarikoptic
yarikoptic / get-travis-buildlogs
Created February 16, 2014 20:29
A tiny Python script to fetch travis build logs
#!/usr/bin/python
#emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 noet:
#------------------------- =+- Python script -+= -------------------------
"""
@file travis-logs.py
@date Wed Mar 27 15:20:16 2013
@brief
Created: Wed Mar 27 15:20:16 2013
@yarikoptic
yarikoptic / gist:0e1294c0cf16fd471727
Created August 13, 2014 19:48
stackbrew description for neurodebian images

Built with Stackbrew from http://github.com/dotcloud/stackbrew/blob/master/library/neurodebian . Stackbrew Dockerfiles were generated using https://github.com/neurodebian/dockerfiles/blob/master/gen_dockerfiles script based on NeuroDebian configuration file and Stackbrew's debian and ubuntu-debootstrap images.

NeuroDebian images only add NeuroDebian repository and repository's GPG key. No apt indexes are downloaded, so apt-get update needs to be ran before any use of apt-get. At the time of this writing, a partial list includes:

> docker images neurodebian
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
neurodebian         jessie              889525700b61        4 hours ago         90.08 MB
neurodebian         nd80                889525700b61        4 hours ago         90.08 MB
neurodebian         latest              c34c9c7ba1bf        4 hours ago         85.21 MB

neurodebian

#!/bin/bash
set -eu
cd $1
# First we will deal with .git/annex/objects
for d in .git/annex/objects/??/??/*; do
[ -d $d ] || continue
chmod +w $d $d/..
# although it must be the same name, let's be uber careful
mv $d ${d}_
File "/home/buildbot/buildbot/venv/local/lib/python2.7/site-packages/buildbot/steps/source/git.py", line 185, in full
yield self.copy()
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1097, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/home/buildbot/buildbot/venv/local/lib/python2.7/site-packages/buildbot/steps/source/git.py", line 204, in incremental
action = yield self._sourcedirIsUpdatable()
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 577, in _runCallbacks
current.result = callback(current.result, *args, **kw)
12/07/15 15:44:30 DAEMONCORE: ReadCommand()
12/07/15 15:44:30 DAEMONCORE: EnableCrypto()
12/07/15 15:44:30 DAEMONCORE: VerifyCommand()
12/07/15 15:44:30 DAEMONCORE: SendResponse()
12/07/15 15:44:30 DAEMONCORE: SendResponse() : m_new_session
12/07/15 15:44:30 DAEMONCORE: ExecCommand(m_req == 516, m_real_cmd == 516, m_auth_cmd == 516)
12/07/15 15:44:30 ForkWorker::Fork: New child of 130209 = 138693
12/07/15 15:44:30 Number of Active Workers 0
12/07/15 15:44:30 DaemonCore: No more children processes to reap.
$> GIT_TRACE=1 'git' 'annex' --debug 'copy' '-c' 'annex.ssh-options="-S /var/run/user/47521/datalad/datalad.org"' 'Banner for bogus1-2' '--to=published15'
11:33:00.660049 git.c:560 trace: exec: 'git-annex' '--debug' 'copy' '-c' 'annex.ssh-options="-S /var/run/user/47521/datalad/datalad.org"' 'Banner for bogus1-2' '--to=published15'
11:33:00.660095 run-command.c:338 trace: run_command: 'git-annex' '--debug' 'copy' '-c' 'annex.ssh-options="-S /var/run/user/47521/datalad/datalad.org"' 'Banner for bogus1-2' '--to=published15'
11:33:00.697220 git.c:348 trace: built-in: git 'config' '--null' '--list'
11:33:00.716531 git.c:348 trace: built-in: git 'show-ref' 'git-annex'
11:33:00.719462 git.c:348 trace: built-in: git 'show-ref' '--hash' 'refs/heads/git-annex'
11:33:00.722880 git.c:348 trace: built-in: git 'log' 'refs/heads/git-annex..47313ce619b66d2b267e48e3d6d12f58e045ac29' '-n1' '--pretty=%H'
11:33:00.728138 git.c:348 trace:
# An example from https://en.wikipedia.org/wiki/YAML#Advanced_components
# pretty printed as .json after "expansion":
$> cat /tmp/sample.yaml
# sequencer protocols for Laser eye surgery
---
- step: &id001 # defines anchor label &id001
instrument: Lasik 2000
pulseEnergy: 5.4
pulseDuration: 12
repetition: 1000
import image
import math
angle = 10 # we humans think degrees
angle = angle*math.pi/180 # radians
img = image.Image("golden_gate.png")
height = img.getHeight()
width = img.getWidth()
win = image.ImageWin(width, height)
# old openfmri (excluding DataLad revisions)
git)smaug:/mnt/btrfs/datasets/datalad/crawl/openfmri[master]git
$> for ds in ds*; do nver=$(git -C $ds tag | grep -v '+' | wc -l) ; echo "$ds: $nver" ; done
ds000001: 7
ds000002: 7
ds000003: 5
ds000005: 4
ds000006: 4
ds000007: 4
ds000008: 4
@yarikoptic
yarikoptic / walk.py
Created May 15, 2020 16:39
A dirty helper to time traversal of the file tree and collection of os.stat results for files. See https://github.com/con/pyfscacher/issues/1 for more info
#!/usr/bin/env python
import os
from os import stat
from os.path import join, islink
from time import time
from pathlib import Path
from functools import wraps
from joblib import Parallel, delayed