Chivil blog

Aller au contenu | Aller au menu | Aller à la recherche

avril, 24 2014

Twisted and OpenSSL error

Once again, since I didn't find anything relevant while searching the web, here's a post.

While trying to connect to a remote SSL host using Twisted, and getting an error in the certificate validation.

If you're trying to get the meaning of the errnum parameter of the callback of the ctx.set_verify method (usually named verifyCallback from here).

The errors codes / numbers are actually from OpenSSL and listed here: https://github.com/openssl/openssl/blob/master/crypto/x509/x509_vfy.h

Unfortunately, it seems there is no textual representation in case you wished to log them in a meaningful way >_<

juillet, 29 2012

MMS, CyanogenMod et Bouygues Telecom

Pour les gens qui, comme moi, sont passés à CyanogenMod ICS sur leur téléphone Android, et qui ne parviennent plus à envoyer de MMS, avec le message "Envoi en cours" qui reste là indéfiniment.

Pour les gens chez Bouygues Telecom (ou B&You :) avec les réglages par défaut de l'opérateur.

C'est un bug de l'application MMS, il y a deux problèmes :

  • l'application à l'air d'ignorer le réglage préféré, et tente tous les APN un par un
  • le premier APN (de ceux réglés par défaut) fait planter le service chargé de faire l'envoi :)

En conséquence, tous les réglages que vous pouvez essayer ne changent rien si ils ne sont pas fait dans le premier APN de la liste.


Pour corriger le problème, il faut supprimer le premier APN : "Bouygues Pro" (en tout cas, chez moi)

Ouvrir les paramètres système, choisir "Plus…"

1-parametres.jpg

Puis "Réseaux mobiles"

2-sans-fil-reseaux.jpg

Sélectionnez ensuite "Noms des points d'accès" pour la liste des APNs

3-reseau-mobile.jpg

Avec les réglages par défaut de l'opérateur vous devriez avoir ceci, choisissez "Bouygues Pro"

4-apn.jpg

Sur l'écran suivant, vous pouvez noter que le réglage MMSC n'est pas défini, c'est ce qui cause le bug dans l'application MMS.

Utilisez simplement la touche menu pour pouvoir supprimer cet APN

5-apn.jpg

Et voilà. Si les réglages de l'APN suivant sont correct (et je suppose qu'ils le sont parce que comme moi vous avez du vérifier 20 fois qu'ils étaient bons), l'envoi et la réception de MMS devraient pouvoir fonctionner correctement.

Si vous n'utilisez pas CyanogenMod et que cette astuce vous a permis de résoudre l'envoi de MMS, merci de laisser un mot pour que je puisse corriger le billet ^^

avril, 04 2011

Unix, clear screen

Once again, since I didn't find anything relevant using Google, I'm posting a solution here to a simple problem I had.

To simply clear (reset) your terminal's screen in a shell, the character sequence is escape character, then c

in python

import sys
sys.stdout.write("\033c")

or in perl

print "\033c";

mars, 09 2011

Screen, vim, 256 colors

Since I had to dig a little to find how to make vim works fine in 256 color mode (using set t_Co=256), I'm pasting it here so it might help some people :)

So, I only had to add this:

termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
defbce on

to my .screenrc file.

Then just screen -r again and it should work fine (did for me, on a Debian Lenny, and an Ubuntu 10.10)

edit: seems that in some cases, you have to start a new screen session :-/

septembre, 01 2010

Readability bookmarklet on Android 2.2

Since I've been trying use Readability for quite a while on my Android phone and just found out how to do so today, I'm posting it here :)

For those who don't know Readability, it's a bookmarklet that, once triggered, will remove all layout of a website, only to keep the contents. It's really useful when reading pretty much any article.

Since phones have a very limited space to display content, it's often painful to zoom in and try to fit an article's text in the screen. Readability is really helpful here.

Since Android's browser doesn't allow bookmarking javascript, we'll have to trick him a bit.


First, go to http://lab.arc90.com/experiments/readability/ and customize your layout.

Then copy the link

read.png


Then, go to Pastebin to paste the javascript you just copied

pastebin.png

(triggered their antispam here)


You'll get an url that you will be able to type inside your Android browser (that's a pain, be careful of lower/upper case)


Once you get the Pastebin url on your phone, just long "click" (press) on the textarea (not the first block ;) to copy the link in your phone's clipboard

copy.png


Then, go to your bookmarks, add a new one, and just paste the link using the long click on the Location field

addbookmark.png


And your done, now you just have to visit that bookmark when reading an article to trigger the script readme.png

mai, 28 2010

git svn update automated

To allow git-svn users to do the equivalent of a svn up in one command, instead of saving local changes to the stash before rebasing (then dropping the stash)

Warning keep in mind that this will discard the current index

In your ~/.gitconfig file:

[alias]
    svnup = !DIRTY=$(git status --porcelain -uno) && \
        git stash save svn-up-auto && git svn rebase && \
        test -n \"$DIRTY\" && git stash pop

    svncommit = !DIRTY=$(git status --porcelain -uno) && \
        git stash save svn-up-auto && git svn dcommit && \
        test -n \"$DIRTY\" && git stash pop

décembre, 09 2009

Git: find commit pointing to specific file

Just posting here a solution to a problem I had and could not find easily.

The problem was .. how do I find which commit contained a specific version of a file?

With the file at hand, I could simply use git-hash-object to have its hash

git-hash-object file.pl

afb2de5691078405dde84b3c1ba07ae3611f5396

Easy enough. The real problem was : how do I find references to this hash?

The only command I found to do that is git whatchanged

git whatchanged

commit 8296847023cf52d9273f59e93da1f18fa1313004
Author: TrucMuche <muche@54c5169c-8210-0410-b4c6-88e7fb53b929>
Date:   Fri Nov 27 13:49:37 2009 +0000

    some stuff

Then just search for the short version of the hash (afb2de5):

commit 8d7e23f9589a2858afd7b4f0f5f8f26c8c440541
Author: TrucMuche <muche@54c5169c-8210-0410-b4c6-88e7fb53b929>
Date:   Mon Nov 16 15:26:57 2009 +0000

    some more stuff

:100644 100644 426edf6... afb2de5... M  path/to/file.pl

If anyone knows a better way let me know :-)

juin, 09 2009

Disable Safari 4 Webpage Previews

The easy lazy way :

chmod a-w ~/Library/Caches/com.apple.Safari/"Webpage Previews"

Safari (or anything else) won't be able to write to this directory afterward, it should not grow day after day.

mai, 22 2009

First!

A dummy entry, just here too fill out the blank space here.

I hope to fill the void soon :-P