keeping your shell connected to an agent

One of the most annoying things about using an ssh-agent type process is making sure that the environment in your shell (either from an xterm, from an ssh session or embedded in another application) is always properly setup to connect to that process. Since I use gnupg’s gpg-agent, I wrote the following shell script (sourced in my ~/.shrc) to try and always do the right thing™:

send Graphite output to Slack

Just a quick recipe to send rendered graphs from Graphite to Slack, using your crontab(5) and Incoming Webhooks:

0  5  *  *  * /path/to/script.sh >/dev/null

This will send a message to your webhook’s default channel every day at 5am, and Slack show you a preview of the graph in the channel. For completeness’ sake (!) here’s the contents of `/path/to/script.sh`:

#!/bin/sh
METRIC="stats.gauges.somemetric"
OPTS="from=-2hours&until=now&width=400&height=250"
BASE="https://graph.host.com/render"
GRAPH="${BASE}?${OPTS}&target=${METRIC}&title=${METRIC}"
PAYLOAD='payload={"text": "<$GRAPH|daily metric graph>"}'
curl -s --dump-header - -X POST --data-urlencode "$PAYLOAD" \
 'https://my.slack.com/services/hooks/incoming-webhook?token=XXXXXXXXXXXXX'

target a specific host with an ansible playbook

Sometime you have a playbook that’s all like:

---
- hosts: all
...

and in your inventory you’ve got a long list of hosts that all would expand to. What if you want to just run the playbook for one or two hosts? Then tip by Tybstar is valuable, because you can apparently just add a comma separated list of host names instead of an inventory file name. If you only want one host just add a comma after the name:

ansible-playbook -i "localhost," playbook.yml

As you can see this comes in handy if you just want to run a playbook against localhost.

debugging python objects and fields with gdb

Sometimes your python code crashes or runs into a deadlock. For this the Python Extension for GDB 7 are very handy. On one mainstream Linux distribution this was automatically available when the devel/debug package for python was installed. But this extension has certain limitations, and one that I found quite important was the ability to print individual fields of objects. The “py-print” command truncates it’s output so for a relatively complex object you can’t really see the member attributes.

After looking at the source for this extension I saw it would be relatively easy to fix this. I wrote another command that actually goes through the object’s dictionary and prints out the requested field only. Here’s the gist:

ψευδωνυμία στα κοινωνικά δίκτυα

Πρώτον, προφανώς πιστεύω ότι όλοι έχουμε δικαίωμα να τηρούμε ψευδώνυμους λογαριασμούς, να εκφραζόμαστε ελεύθερα και να μην γινόμαστε στόχος επιθέσεων για αυτά που λέμε.

Επίσης πιστεύω ότι ότι η αποκάλυψη της ταυτότητας ενός ψευδώνυμου αρθρογράφου, ειδικά εάν απειλείται η ζωή και η περιουσία του, μπορεί να είναι ένα μεγάλο φάουλ, όμως αυτό κρίνεται κατά περίπτωση και δεν αποτελεί παραβίαση κάποιου θεμελιώδους δικαιώματος.

Αυτό που θέλω να πω όμως είναι ότι όταν ένα πρόσωπο γράφει ψευδώνυμα, και  υπάρχουν άτομα που γνωρίζουν την ταυτότητα του, πρέπει να αντιλαμβάνεται ότι όχι μόνο δεν έχει πια τον έλεγχο της μυστικότητας της ταυτότητας του αλλά ότι δημιουργεί και μια υποχρέωση σε αυτούς που την γνωρίζουν να κρίνουν την σημασία του συνδυασμού λόγου και ταυτότητας. Συνεπώς ο ψευδώνυμος αρθρογράφος που δεν λαμβάνει υπόψη του ότι συνέπεια της ψευδωνυμίας του είναι η δημιουργία μιας υποχρεώσης σε όσους γνωρίζουν την ταυτότητα του να αξιολογούν τον λόγο του, πράττει μάλλον απερίσκεπτα και θα έλεγα και ανεύθυνα. Άρα η ευθύνη λοιπόν δεν είναι μόνο όσων γνωρίζουν την ταυτότητα, να μην γίνουν “ρουφιάνοι” και “χαφιέδες”, αλλά και αυτού που γράφει ψευδώνυμα. Είναι και αυτός υπεύθυνος εάν οι γνωρίζοντες εξαναγκαστούν σε διλλήματα που αυτός δημιούργησε.

Σε μια συγκεκριμένη περίπτωση που γνωρίζω, μέλη μιας συλλογικότητας γράφουν ψευδώνυμα στο Facebook ή στο twitter και λένε πράγματα που, ταυτιζόμενα με την πραγματική τους ιδιότητα, θα δημιουργούσαν εντυπώσεις για την συλλογικότητα εκείνη τότε είναι προφανές ότι παίρνουν ένα ρίσκο για όλα τα μέλη, όχι μόνο για τους εαυτούς τους. Να το κάνουν, εφόσον πιστεύουν ότι είναι αναγκαίο, αλλά να μην περιμένουν κιόλας ότι υποχρεωτικά όλοι θα είναι σύμφωνοι και ότι θα κρίνουν την προστασία της ψευδωνυμίας ως την σημαντικότερη πλευρά των αναπόφευκτων διλλημάτων που εκείνοι δημιούργησαν.

Τέλος, αν θέλει κανείς να γράφει ψευδώνυμα και μάλιστα περιμένει να προστατεύεται η ταυτότητα του από τα υπόλοιπα μέλη της συλλογικότητας, τότε να φροντίζει να την προστατεύει και ο ίδιος, αποφεύγοντας να εκθέσει ταυτοποιητικά στοιχεία όπως τμήματα του ονόματος του, φωτογραφίες, ή πληροφορίες που μόνο εκείνος μπορεί να γνωρίζει. Διαφορετικά φέρεται ανεύθυνα έναντι τους, εκθέτοντας τους αναίτια σε διλλήματα που ο ίδιος δημιούργησε. Δικαίωμα του θα μου πείτε, και θα συμφωνήσω. Αλλά έτσι είναι η ζωή, κάποια δικαιώματα έχουν και παρενέργειες, π.χ. η ψευδωνυμία μπορεί να σε οδηγήσει σε μια ψεύτικη αίσθηση προστασίας και να πεις πράγματα που θα μετανιώσεις αργότερα. Οπότε ελπίζω απλά να γίνουν τα παθήματα μαθήματα.

 

journal entry for Monday the 6th of January

journal entry for Monday the 6th of January by kouk

Hello 2014. Let’s see, will I succeed in keeping a journal like I’ve promised myself many times before? “This time it’s different”, right? Well is it? Yes, at least in two ways:

  • I will publicize publish at least two entries a week on my blog. At least, while in between I may keep private entries or not.
  • The handwritten paper should also be published alongside the text. Yes it’s a bit of extra work but maybe it will help me with my handwriting, and also appeal to some readers who are hipsters like me :-)

But why keep a journal in the first place? Well I think that the struggle to find the right words to say something is fruitfull in many ways. Writing is  a Great technology, capital G. But in the process you learn a lot about what you know and what you are. An extra reason to keep a journal is as an exercise in discipline. Kind of like getting up in the morning and going running, you win just by exiting the house. So I could stop right here I suppose and chalk one up.

The empty page however beckons.

My thoughts on the new year are a bit unclear. All through the previous year I had been planning that it would be great in a a particular way. Now, the particulars are wiped away and I have to improvise. Lesson #1 don’t dream about particulars, have broader dreams. The major particular that I was dreaming of was my girlfriend moving in with me, and our relationship progressing to new heights. Instead, under the fog of this all important goal, reality brought a sudden and painfull breakup between Christmas and New Years. Don’t ignore reality, it’ll bite you like a feral dog.

The upshot is I can focus more easily on the new job, which I’m excited about and have (broad) hopes about :-D

Here’s to an exciting and productive new year for all of you!

My Linux OS history

Following Nikos and Vagelis here’s a (possibly incomplete) timeline of my personal OS usage:

  • MS-DOS (~1990) , on a 486dx-based tower (even had “turbo“!), mostly for games
  • System 6 (early ’90s) , on a Classic, for games, paint and word processing
  • Red Hat 6 (1999), brought over by a friend to try Linux for the first time.
  • SUSE Linux (2000?), flirting with graphical configuration tools like YaST. Bought an original CD along with an original copy of CodeWarrior IDE! This was the first time I bought original software. Previously I had only used “friendly” copies (either for free or through the shops around Stournara street). SUSE was the last Linux I have used on Desktops or workstations.
  • Tried NetBSD (2002) but after a while I tried OpenBSD and ended up ordering a copy of OpenBSD 3.2. Still have that home firewall box lying around somewhere. Used OpenBSD until 2008.
  • In the era of unsupported laptop hardware (2003+) I have used the following Linux distros (in no special order):
  • In 2008 most colleagues ran Debian GNU/Linux so I attempted a compromise with Debian GNU/kFreeBSD. Used it as a personal workstation at work for about a year, great project! However the effort required in configuring, tweaking and bug reporting eventually got the best of me so I switched to…
  • FreeBSD! (2009-currently) The features in CURRENT at the time (VIMAGE, DTrace, ZFS with GPT) were just too great to ignore (especially ZFS not being experimental anymore). Currently run FreeBSD 9 on a workstation and on a Thinkpad X series laptop. If  my other hardware wasn’t broken or unsupported in some way I would run it everywhere.

an alternative to subsidising recycling?

Having just read “Recycling: can it be wrong when it feels so right?” on Cato Unbound , and having laughed at myself for also wasting my time separating the trash that our city burries in landfills anyway, I tried to think of the suggested solution. How can we devise a system as is suggested in the article:

A property rights system that assigns disposal responsibility, and ultimately liability, to the manufacturer would encourage the use of effective market incentives to reconceive the very nature of waste itself

One thought I had was imposing an excise tax on products whose packaging might go to waste, either by being burried in a landfill or by requiring an undue amount of resources in order to recycle. But there is no way to figure out what the right amount of tax is in order not to distort incentives involved. One other way would be to mandate that all product packaging may be returned to the retailer who sold the package. But for customers to do this they must have an incentive. This could be, for example, a refund on the excise tax. Of course a retailer should be able to choose to recycle the returned packaging and consequently gain an exception to the tax.

And it could also be kind of like a Value Added Tax but in reverse. The tax for every returned amount of packaging must be refunded by the original supplier to the person or company who is returning it, who must refund the tax to the person that they sold the item to next, all the way down to retail level and the end-consumer. And the sum of the unrefunded taxes that remain can be used to combat illegal dumping, whether via policing or subsidised landfills.

Any comments welcome!

vertical preview pane in gmail

I’m trying out this lab, perhaps late to the party but anyway. I kind of like it, especially the vertical split.

My 2 issues: I use the keyboard shortcuts j,k to view or select the next or previous message respectively. This works fine, although I would prefer that the cursor moved without actually opening the next or previous message. I could use the ‘o’ keyboard shortcut to actually view the message. The actual problem I have is that when the cursor goes below the end of the viewport the list of messages doesn’t scroll. Any one have any idea about a workaround?

(using google chrome)

IT Service! Διαχειριστής Συστήματος ®

Got this spam message, made me laugh (or hellenophones only, sorry!):

Webmail κέντρο συμβουλές σε όλους τους χρήστες του λογαριασμού e-mail στο απαντήστε σε αυτό το μήνυμα.

Είμαστε σήμερα αναβάθμιση βάση δεδομένων μας και e-mail κέντρο λογαριασμό. Είμαστε διαγραφή λογαριασμών που δεν είναι επί του παρόντος σε χρήση για τη δημιουργία περισσότερων χώρος για νέους λογαριασμούς. Για να αποφευχθεί ο λογαριασμός σας δεν θα πρέπει να περικοπεί, σας συνιστούμε να αντιγράψετε ή κάντε κλικ στον παρακάτω σύνδεσμο και την καλοσύνη να συμπληρώσετε το απαιτούμενες πληροφορίες?

Κάντε κλικ εδώ: http://beautifulfabulousfamous<…>

Εμείς ειλικρινά συγγνώμη για την ταλαιπωρία αυτή.
Με εκτίμηση,
IT Service!
Διαχειριστής Συστήματος ®
Αναβάθμιση του λογαριασμού σας!

ps. the sender name reminds me of the film (video) and of course the band called Godspeed You! Black Emperor (audio).