Pip on YouTube with safari workaround

I’ve just discovered a -probably well known- workaround to get pip on ios9 on the YouTube website. 

The trick is to use the “pc” ‘version of the website:

1- click on the 3 dots

2 it brings the menu to switch to the “pc” version of the side

3- now you can acces to the pip option

Hope it helps!

Find the closest values of an array

Recently, I face a quite simple problem : I have an array A (100,200) containing values I want to interpolate and I have another array I (5000), containing interpolated values. How to efficiently find tthe closest interpolated values of rach elements of A in I ?
That post give me 90% of the answer. It details how to efficiently find the index of a single value v  into an array arr. The one line magic formula is :

idx = (np.abs(arr - v)).argmin()

but here v is a number and arr is a 1 dimensional array. How my problem can fit in that solution ?

By using broadcasting of course !

I must find for each dimensions of my array the one which fits the values of I. So the solution of my problem is :

idx = (np.abs(A - I[:,None,None])).argmin(axis=0)

Hence idx is idx.shape == A.shape, and it contains indexes where I has the closest values of A.


Sublime Text Extensions

If Sublime Text is become my favourite text editor, it’s principally due to the huge amount of available extensions.

I’d like to share here my default ones.

Package Control

Once sublime text installed, the first step consist into adding the package control, in order to install the following extension in a heartbeat:

Once package control install, you could install further extensions by hitting : CTRL+SHIFT+P and choose “install package”


My Favourite Extensions

Now, I’ll list some useful package for python development :

  • GitSavy : Manage git repository directly in Sublime Text. The interface is very clear and this truly improve the git experience. You can just take a look on the animated gif on the github page for convincing you.
  • GitGutter : Display modification between your current code and last commit
  • Ctags(*): Brings the classical vim Ctags to sublime text. You can thus directly go to function definition using the “CTRL+T CTRL+T” (twice) shortcut.
  • Origami : Split windows using keyboard shortcuts
  • SideBarEnhancements : To increase te capability of sidebar (rename files, quickview,…)
  • LaTexTools : Editing Latex into sublime text
  • Pylinter : A python linter directly integrated in Sublime Text ( Note: require a manual installation and configuration of pylint.) I stop using pylinter due to the huge amount of used CPU. I probably get back later.

Many other useful extensions can be found on https://packagecontrol.io/ ,  here and  here (French)


(*) Ctags also require to specify a language to operate correctly. For e.g. Python, this can be specified in the user settings of ctags with :


Then you can just it “CTRL+T CTRL+R” to launch/reload the ctags indexation of your files.

sublime text shortcuts in IPython / Jupyter notebook

If you are a daily user of sublime text, you probably feel very frustrating to not have your classical shortcuts into the IPython/Jupyter notebook.

Hopefully the version 4 of Jupyter allows you to retrieve your favorite sublime text keybinding in your browser.

You just have to copy/paste the following line and add it into your ~/.jupyter/custom/custom.js file :

require(["codemirror/keymap/sublime", "notebook/js/cell"],
function(sublime_keymap, cell) {
cell.Cell.options_default.cm_config.keyMap = 'sublime';

Thats it , now you can launch your notebook and start editing without complains 🙂

If it does not work, you may also try to replace the code above by this one :

require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace"],
function(sublime_keymap, cell, IPython) {
// setTimeout(function(){ // uncomment line to fake race-condition
cell.Cell.options_default.cm_config.keyMap = 'sublime';
var cells = IPython.notebook.get_cells();
for(var c=0; c< cells.length ; c++){
cells[c].code_mirror.setOption('keyMap', 'sublime');

    // }, 1000)// uncomment  line to fake race condition 


Minimize airfoil audio delay

Before Apple introduces an easy airplay management directly into osX with Mavericks, Rogue Amoeba Airfoil was the most convenient solution to stream your music on your airplay compatible speakers. However, Airfoil still proposes several interesting improvements compared to the Apple build-in solution.  In particular, it allows to stream a specific audio source from your mac ( whereas Apple solution stream either the entire system sounds or iTunes music) and manage multiple Airplay output in the same time.

Airfoil is clearly a very convenient solution but it has a major drawback compare to the native Airplay support : it introduces a notable audio delay during streaming ( ~2 seconds ). This does not sounds as a big deal but it is clearly a bit frustrating days after days, and it prevent to use it in cases where latency is a bottleneck e.g. using Airplay speakers as Garageband output for instance.

Airfoil users, I’ve a good news : there is a workaround to get rid with this delay !

Just before the explanation I would precise the common tagline of every hack method :

Please note that I do not take any responsibility if something goes wrong with my method, you do it at your own risk for your software and hardware parts !

Okay, now it’s done here is the trick :

1- Launch Airfoil by double clicking the icon and maintaining  the left option/alt key. This will launch Airfoil debugging mode.

2- Check the “Realtime local playback ” option and set the speaker delay in seconds to “0.0”

2015-06-01 21h37m

3 – click Done and that’s it !

Airfoil now streams your audio outputs with a very low latency !

It is not clear what is the impact of this hack on the stability/performances of the Mac but I didn’t notice any differences.


[Edit june 2016]

Airfoil v5.x has a native setting for latency !

You can set the latency for each speaker in :

Speaker => Advanced Speaker Option


Sublime Text

Sublime Text is a wonderful code editor. In addition to several powerful features, the main interest of the tool is the possibility to add extensions.


See the dedicated post on My favorites Sublime Text extensions

Configuration File

The Sublime text configuration is done through a Json file. Here is some configuration keys:

  • shift tab indent length
&amp;amp;amp;quot;tab_size&amp;amp;amp;quot;: 4
  • unindent with shift tab
&amp;amp;amp;quot;shift_tab_unindent&amp;amp;amp;quot;: true
  • display white spaces
&amp;amp;amp;quot;draw_white_space&amp;amp;amp;quot;: &amp;amp;amp;quot;all&amp;amp;amp;quot;
  • Display rulers

Here is my config file:

{&amp;amp;amp;quot;auto_complete&amp;amp;amp;quot;: false,
&amp;amp;amp;quot;auto_match_enabled&amp;amp;amp;quot;: false,
&amp;amp;amp;quot;color_scheme&amp;amp;amp;quot;: &amp;amp;amp;quot;Packages/User/Monokai (SL).tmTheme&amp;amp;amp;quot;,
&amp;amp;amp;quot;detect_indenation&amp;amp;amp;quot;: false,
&amp;amp;amp;quot;dictionary&amp;amp;amp;quot;: &amp;amp;amp;quot;Packages/Language - English/en_US.dic&amp;amp;amp;quot;,
&amp;amp;amp;quot;draw_white_space&amp;amp;amp;quot;: &amp;amp;amp;quot;all&amp;amp;amp;quot;,
&amp;amp;amp;quot;font_size&amp;amp;amp;quot;: 10,
&amp;amp;amp;quot;shift_tab_unindent&amp;amp;amp;quot;: true,
&amp;amp;amp;quot;tab_size&amp;amp;amp;quot;: 4,
&amp;amp;amp;quot;translate_tabs_to_spaces&amp;amp;amp;quot;: true


When you’re working to a project, you can add all related file into a sublime text project. To this end:

Go to Project=> Add Folder to Project

Select your project directory and now all your files are available in the side bar ( View -> side bar -> show sidebar or CTRL+K then CTRL+B).

Then your files can be reached by the Goto Anything feature (see next section)

Then you can save you project (Project -> save Project), and use the Project Quick switch feature (CTRL+ALT+P)


Some very useful shortcuts for Ubuntu:

Code Navigation

  • CTRL+P : Go to Anything (a.k.a. type to open a file from your project)
  • CTRL+R : Go to Function, in a given file, find a class/method
  • CTRL+P+: : Go to Line
  • F5 : go to definition (function, class,….)
  • ALT+- / ALT+SHIFT+- : jump back and Forward (a.k.a. go back and forward in cursor position ). This is a really powerful feature !
  • CTRL+SHIFT+T : re-open last closed tab


  • selection and CTRL+D : select one by one all occurrences of selection ( press CTRL+K to skip current selection)
  • selections and CTRL+L : Multiple cursor at selections positions
  • selection and ALT+F3 : select all occurrences of the selection


Sublime text support snippets and activate them through a trigger key (e.g. hit TAB). Snippets are very easy to configure using the documentation.

You just have to create a file with the extension : .sublime-snippet and put it into the Sublime Text User  directory.

Example : ipdb

Here is a quick look of the features I use the most in Sublime Text. I’ll try to update this article simultaneously to my future discoveries (a.k.a. your suggestions in comments 😉 ).

Freebox revolution Alfred workflow

I’ve just coded a very short and non perfect Alfred workflow to be able to use command a freebox player (French set-top box), using Alfred’s workflows.

It can be downloaded on packal : freebox_revolution

This is definitely with non guarantees and requiers many improvement.

I hope it can help some of you.


updated with curl instead of wget (thx real3x)

Inkscape native version for OS X ML

After fighting several hours with keyboard mapping issue with inkscape 0.48 , I found the graal ;

Native ML packaging of Inkscape 

This is a Release candidate version, but I don’t face any bug. First launch is a bit long, but after, it works very well

I don’t know who to thank for this work but if he read those lines i just want to say : THANK YOU !!!!

Of course, my previous blog post on textext is still relevant with this version.

edit : link to native version updated

edit2 : add a link of the RC5 release from my Dropbox:

from my dropbox


I finally found the source of those files. It comes from the Inkscape developers forum. The thread of interest (last updated : 29 June 2014) can be found here.


Official direct link Inkscape web site  ( thanks @jogancalagan)

inkscape + textext on Mac os x mountain lion

I’m a regular user of Inkscape for creating illustration of my papers. And one of the convenient Inkscape extension is Textext. Textext allows to write directly your latex formula in Inkscape and to re-edit them later (see website for more precisions).

I spend many hours on the web to find a way to install the Textext extension on my mac (10.8.4), tried almost lots of tricks, but I always faced an issue with the ““The fantastic lxml wrapper for libxml2 is required….” issue when I try use it !
[Edit 07/17: an alternative/better solution than the following can be found Here, thanks fsfarimani ]

I finally, I found the solution ! Here is the workflow:

  1.  Download/Install Inkscape ( note that you need Xquartz 2.3.4 or higher installed on your Mac)   the last RC of native os X  version of  Inkskape  HERE
  2. Download Textext last version from here
  3. Download/install the Eggbot extensions for Inkscape (This is the magic trick !)
  4. Browse inkscape package contents, find the extension directory and copy the 2 Textext file into
  5. Now you can use Textext extension on your mac !

I hope it works for you too !



backward sync using okular + sublime text 2 + latextool

I recently discover Sublime text 2 (ST2), and it’s definitely  my favorite IDE for  python and latex (at least)! Using Latextool plugin of ST2 allows to compile your latex code with pdflatex and obviously see the result into the default ubuntu pdf viewer tool : Evince. The bad thing here, is that the backward sync (from the pdf, find the corresponding part of your code) doesn’t work for me.

So I’ve decided to move to Okular to get that synchronization working again. And it work under the condition to have the correct okular configuration which is :

Settings => Configure Okular => Editor

Chose Custom text editor and add the following line :

<path_to_your_sublime_text2_app>/sublime_text %f:%l

And here we go, you have the backward synchro.

However , it remains some other minor issues to solve :

  •  launch okular by default after pressing CTRL+B in Sublime text
  • activate the forward synchro.