Archive for the ‘Uncategorized’ Category

debian wheezy getent initgroups for systemd-231 systemd-nspawn

Monday, November 7th, 2016

systemd-nspawn requires a working ‘getent initgroups’ when run with the ‘-u’ switch. Replicating what fedora gives:

mv /usr/bin/getent /usr/bin/getent.orig

contents of /usr/bin/getent


import sys
import os

if sys.argv[1] != 'initgroups':
    os.execv('/usr/bin/getent.orig', sys.argv)

with open('/etc/group') as fd:
    lines = fd.readlines()

user = sys.argv[2]
boo = [x.split(':') for x in lines]
l = [x[2] for x in lines if user in x[3].split(',')]
if len(l) == 0:
    print('{:22}{}'.format(user, ' '.join(l)))

Updating the flickr badge on galgalyarok

Saturday, January 9th, 2016

I just installed a nice Let’s Encrypt generated certificate (webfactional is the host, they still do not support this natively, but their support ticket workflow took a day, so that’s good enough). I reload and discover I get at first a nice green padlock icon which is then shortly later replaced by a yellow padlock with an exclamation mark. Clicking on it reveals (this is similar in both firefox and chrome, recent editions) that some of the content is not encrypted. Using the network monitor I track some links, grepping in a mysql dump I find the related settings (some in a blog post by my brother referring to a no longer accessible facebook image – lucky that the web archive exists, and that we pointed it to galgalyarok a long time ago. an image of lotem smiling at hanan has survived him). Last is a badge for flickr. The badge uses an API that returns hard coded http scheme, but it has been superceded by a v2 API. But curl reveals the return is completely different, and some googling brings me to a plugin for flickr badges that uses that API (actually that was the one that familiarized me with said API). So now trying to install that.

The plugin works nicely and uses the correct scheme (https), Flickr Badges Widget, I used 1.2.8.

Btw getting LE to run on WF using older libraries was a pain, amazing how compiling stuff and installing python modules as a user is still a pain after 20 years of linux. Had to build libffi for the cryptography suit, and patch in a really ugly way an enum (enum.Enum) used incorrectly. Or probably I somehow got it to an unexpected state. It worked, eventually, using

letsencrypt -d -vvvv --text --agree-tos --config-dir /home/alon --work-dir /home/alon/tmp --logs-dir /home/alon/log certonly --webroot-path /home/alon/webapps/galgalyarok/

This blog post is just a way to record the old widget code. Hanan used a text widget with the title “Pics” and the following content (you can get his flicker ID from the below code, enjoy):


<!– Start of Flickr Badge –>
<style type=”text/css”>
.zg_div {margin:0px 5px 5px 0px; width:157px;}
.zg_div_inner {border: solid 1px #000000; background-color:#ffffff;  color:#666666; text-align:center; font-family:arial, helvetica; font-size:11px;}
.zg_div a, .zg_div a:hover, .zg_div a:visited {color:#3993ff; background:inherit !important; text-decoration:none !important;}
<script type=”text/javascript”>
zg_insert_badge = function() {
var zg_bg_color = ‘ffffff’;
var zgi_url = ‘’+zg_bg_color+’&zg_person_id=8634367%40N07’;
document.write(‘<iframe style=”background-color:#’+zg_bg_color+’; border-color:#’+zg_bg_color+’; border:none;” width=”113″ height=”151″ frameborder=”0″ scrolling=”no” src=”‘+zgi_url+'” title=”Flickr Badge”><\/iframe>’);
if (document.getElementById) document.write(‘<div id=”zg_whatlink”><a href=””    style=”color:#3993ff;” onclick=”zg_toggleWhat(); return false;”>What is this?<\/a><\/div>’);
zg_toggleWhat = function() {
document.getElementById(‘zg_whatdiv’).style.display = (document.getElementById(‘zg_whatdiv’).style.display != ‘none’) ? ‘none’ : ‘block’;
document.getElementById(‘zg_whatlink’).style.display = (document.getElementById(‘zg_whatdiv’).style.display != ‘none’) ? ‘none’ : ‘block’;
return false;
<div class=”zg_div”><div class=”zg_div_inner”><a href=””>www.<strong style=”color:#3993ff”>flick<span style=”color:#ff1c92″>r</span></strong>.com</a><br>
<script type=”text/javascript”>zg_insert_badge();</script>
<div id=”zg_whatdiv”>This is a Flickr badge showing public photos and videos from <a href=”″>hanan_levy</a>. Make your own badge <a href=””>here</a>.</div>
<script type=”text/javascript”>if (document.getElementById) document.getElementById(‘zg_whatdiv’).style.display = ‘none’;</script>
<!– End of Flickr Badge –>


Dali Lama: Ethics more important then Religion

Tuesday, October 27th, 2015

Interview with Franz Alt, mentioned by him during the keynote at the 14th World Wind Energy Conference & Exhibition.

Prop 19 short clip about how grass became outlawed in the states

Thursday, April 24th, 2014

Translated to hebrew.


Meat: future

Saturday, March 15th, 2014

Why we need? we do, stop asking

How to produce? raise animal, kill animal, process animal, eat flesh.

What side-effects? large land use, water use, disease from close proximity crosses to humans, suffering

Is better way? yes, take cell from animal, grow cells to tissue, process tissue, eat tissue.

really? yes, like interleukin, insulin, beer, only more complex. is cultured meat.

is sci-fi? no, human windpipe transplanted, rat kidney research, modern meadow leather TED, cultured hamburger.

is next year? not quite, is new harvest goal

no hebrew? העמותה לחקלאות מודרנית

Good people not caring

Wednesday, December 11th, 2013

That’s what people always say to explain the lack of momentum for their save the world project. It’s automatic: A is good, A is essential, why isn’t everyone doing A? That’s how I feel about my current pet project, medicine. I recall joining my brother for a visit to the carrot forum, a group of green minded people meeting to advance their goals, and feeling like an outsider, thinking ‘this is cool’ and then going back to my business. How do you get people to cross the divide? it’s an age old question, this short post is not contributing to it, simply giving a point in time when I have started considering that question. Keeping in mind my usual attention span it is probably also the point in time when I stopped considering it. Peace.

Miditech keyboard with linux

Thursday, July 4th, 2013

Got a “Garagekey mini” usb midi keyboard of miditech for ~300 nis. It doesn’t google well, but surprisingly alsa wise worked out of the box. My only complaint is that occasionally it will stop producing output (aseqdump -p 20 will produce nothing), solvable by disconnecting and reconnecting the device.

Next I wanted to get a working keyboard automatically after connecting it to my laptop. This turned out to be more complex then I thought. Problems included:

1. (not a problem, just a not very optimal thing) have to edit udev as root to respond to insertion events:

$ cat /etc/udev/rules.d/99-miditech-garagekey.rules
ACTION==”add”, ATTR{idVendor}==”1acc”, ATTR{idProduct}==”1a0f”, RUN+=”/home/alon/bin/miditech”

2. jackd is not actually a daemon, and my feeble understanding of dbus resulted in having to run it with DISPLAY set

3. (not absolutely neccessary) had to setup jackd to run as alon, reading /usr/share/doc/jack-audio-connection-kit- and following the instructions to add myself to jackusr group. Edited /etc/security/limits anyway. Currently jackd complains it cannot lock enough memory but it doesn’t seem to bother it (no hickups). It does get realtime scheduling (doesn’t complain).

4. Ran everything under tmux as my daemnizer. Lame. But works, and also got a gnome-terminal for debugging:

(ugly sleeps for debugging)
$ cat ~/bin/miditech


INSTRUMENT=”/usr/share/zynaddsubfx/banks/SynthPiano/0033-Analog Piano 1.xiz”
export DISPLAY=:0.0

if [ $UID == 0 ]; then
su alon -c “tmux new-session -d -s miditech ~alon/bin/miditech”
su alon -c “gnome-terminal -e ‘tmux attach -t miditech'”
exit 0

while [ “x`pgrep jackd`” == “x” ]; do
if [ $tries -gt 5 ]; then
echo failed to launch jackd
sleep 10000
jackd -T -ndefault -dalsa -dhw:0 -r48000 -p1024 -n2 &
sleep 2
sleep 4
if [ x`pgrep zynaddsubfx` == x ]; then
zynaddsubfx -L “$INSTRUMENT” -e $0.zynaddsubfx.init &
aconnect 20 128
sleep 1000


$ cat ~/bin/miditech.zynaddsubfx.init
jack_connect zynaddsubfx:out_1 system:playback_1
jack_connect zynaddsubfx:out_2 system:playback_2
# aconnect numbers are constant? seem to be
aconnect 20 128

5. (note) to attach from within tmux: (unset TMUX; tmux attach-session -t miditech)

6. determining when jack is ready is annoying. no systemd file either (tried – failed with a dbus error, need to look at that / bug some devel). could use systemd approach of checking for a socket (how would I check for a socket being available? need to lookup what systemd actually does. netstat polling is ugly).

reviewed-by and signed-off-by

Wednesday, April 24th, 2013

This took me a whole day: it adds sorted Signed-of-by and Reviewed-by to a bunch of git commits using the –exec option and overriding the EDITOR environment variable.

Half of the code is from my misspelling of Signed-off as Signed-of, and using the script to fix the resulting mess instead of using a hard reset.


REVIEWED_BY="Some One " git rebase -i --exec git-add-review.exec qemu/master

Script 1: git-add-review.exec

# coding: utf-8

import os

author_replacements = {
'Some One Alias ':
'Some One '

lines = os.popen('git show HEAD').readlines()

author = [l for l in lines if 'Author:' in l]
author = author[0].split('Author: ', 1)[1].strip()

if author in author_replacements:
os.environ['EDITOR'] = 'true'
os.system('git commit --amend --author "%s"' % author_replacements[author])

os.environ['EDITOR'] = 'git-add-review.helper'
os.system('git commit --amend')

Script 2: git-add-review.helper


import os
import sys

with open(sys.argv[-1]) as fd:
lines = fd.readlines()

i_last = -1
for i, l in enumerate(lines):
if l[:1] == '#':
i_last = i

author = [l for l in lines if 'Author:' in l]
if len(author) == 0:
author = os.popen('git show HEAD | grep Author').readlines()
author = author[0].split('Author: ', 1)[1].strip()

reviewed_by = os.environ.get('REVIEWED_BY', 'Anonymous').strip()
print 'AUTHOR*** ', repr(author)
print 'REVIEWER* ', repr(reviewed_by)

author_is_reviewer = reviewed_by[:5] == author[:5] # hack

if author_is_reviewer:
print "author is reviewer"

new_lines = []
signed_lines = []
reviewed_lines = []

for l in lines:
if l.startswith('Signed-of-by:') or l.startswith('Signed-off-by:'):
elif l.startswith('Reviewed-by:'):

print "=== Reviewed-by ==="
print ''.join(reviewed_lines)
print "=== Signed-off-by ==="
print ''.join(signed_lines)
def is_valid_email(x):
return '@' in x
reviewers = set([l.split(':', 1)[1].strip() for l in reviewed_lines
if is_valid_email(l.split(':', 1)[1])])
signers = set([l.split(':', 1)[1].strip() for l in signed_lines
if is_valid_email(l.split(':', 1)[1])])
reviewers -= set([''])
signers -= set([''])

if author_is_reviewer:
reviewers -= set([author])
reviewers |= set([reviewed_by])


new_lines.extend(['Signed-off-by: %s\n' % s for s in sorted(signers)])
new_lines.extend(['Reviewed-by: %s\n' % r for r in sorted(reviewers)])

with open(sys.argv[-1], 'w+') as fd:

Mini post – Going to GUADEC 2012 Coruña

Saturday, July 21st, 2012

I am attending GUADEC at A Coruña, Spain

I’ve been in the spice team for more then two years. I’ve come to work for Red Hat because I believe in open source, and as such I always appreciated being a part of a larger team, the desktop team, inside Red Hat. So going to GUADEC is something personally rewarding to me, like going to FOSDEM was. I’m hoping to attend pdf related talks (I’m interested in better pdf to text hebrew support, and might need to go higher level for that), and actually I’ve already mapped out my talks and am really happy to be going!

moon maps

Thursday, May 3rd, 2012

Lunar Reconnaissance Orbiter map using openlayers for display and mapaplanet (based on isis3) data: