Updating the flickr badge on galgalyarok

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 https://galgalyarok.org/ 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 galgalyarok.org -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;}
</style>
<script type=”text/javascript”>
zg_insert_badge = function() {
var zg_bg_color = ‘ffffff’;
var zgi_url = ‘https://www.flickr.com/apps/badge/badge_iframe.gne?zg_bg_color=’+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=”https://www.flickr.com/badge.gne”    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;
}
</script>
<div class=”zg_div”><div class=”zg_div_inner”><a href=”https://www.flickr.com”>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=”https://www.flickr.com/photos/8634367@N07″>hanan_levy</a>. Make your own badge <a href=”https://www.flickr.com/badge.gne”>here</a>.</div>
<script type=”text/javascript”>if (document.getElementById) document.getElementById(‘zg_whatdiv’).style.display = ‘none’;</script>
</div>
</div>
<!– End of Flickr Badge –>

 

Videos from 2014’s Turbine Hanan

November 9th, 2015

Turbine stands for Ted like URBan night of lectures IN mEmory of. Less contrived acronyms can be left below in the comment section.

We had plenty of lectures. I apologize for the delay, almost a whole year, in placing all the lectures online, but there you are. Almost all of the lectures are available, some of the lecturers asked to remain offline. The rest, the brunt, are available through vimeo, collected here for your pleasure:

And Barak’s epic visual tour from Warwick:
, , , ,

Dali Lama: Ethics more important then Religion

October 27th, 2015

http://www.sonnenseite.com/de/franz-alt/kommentare-interviews/dalai-lama-buch-spiegel-bestseller-nr.-1.html

http://kurier.at/Der+Appell+des+Dalai+Lama+an+die+Welt_English.pdf/139.750.811

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

April 24th, 2014

Translated to hebrew.

http://www.קנאביס.com/2014/04/%D7%A6%D7%A4%D7%95-%D7%9B%D7%99%D7%A6%D7%93-%D7%94%D7%95%D7%A6%D7%90%D7%94-%D7%94%D7%9E%D7%A8%D7%99%D7%97%D7%95%D7%90%D7%A0%D7%94-%D7%9E%D7%94%D7%97%D7%95%D7%A7/

Meat: future

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

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.

Bar Kayma Garden

November 29th, 2013

Today I worked on getting a watering system for the north wall plants. I ended up buying the wrong 1/2-1/2-1/2 two way stop plus external 1/2 hose to 1/2 connector adapter, but it is still installable before the existing faucet instead of after, but we will need to turn off the main since no top floor only stop has been found.

Miditech keyboard with linux

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-1.9.9.5/README.Fedora 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

#!/bin/bash

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
fi

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

#

$ cat ~/bin/miditech.zynaddsubfx.init
#!/bin/bash
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

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.

Usage:

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

Script 1: git-add-review.exec

#!/usr/bin/python
# 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

#!/usr/bin/python

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
break

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:'):
signed_lines.append(l)
elif l.startswith('Reviewed-by:'):
reviewed_lines.append(l)
else:
new_lines.append(l)

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])
else:
reviewers |= set([reviewed_by])

signers.add(author)

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:
fd.writelines(new_lines)

Mini post – Going to GUADEC 2012 Coruña

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!