Skip to content

Instantly share code, notes, and snippets.

View sebastien's full-sized avatar

Sébastien Pierre sebastien

View GitHub Profile
@sebastien
sebastien / gist:3092381
Created July 11, 2012 18:59
Sharing code
<div class="tooltip" style="z-index: 99; display: none; ">
<ul id="share_tooltip">
<li class="email">
<a>Email</a>
</li>
<li class="twitter">
<a href="http://twitter.com/intent/tweet?text=Check%20out%20this%20interactive%20map%20that%20@BizRoundtable%20created%20illustrating%20the%20impact%20of%20trade%20on%20US.&amp;via=BizRoundtable&amp;url=http://trade.businessroundtabledata.org/">Twitter</a>
</li>
<li class="facebook">
<a href="http://facebook.com/sharer.php?u=http://trade.businessroundtabledata.org/">Facebook</a>
@sebastien
sebastien / timeout.py
Created July 12, 2012 15:06
Generates a timeout in Retro
import time
from retro import *
class Timeout(Component):
@on(GET="{_:rest}")
def timeout( self, request, _ ):
time.sleep(20)
return request.respond("OK!")
run(Application(Timeout()))
# EOF
@sebastien
sebastien / gist:3437414
Created August 23, 2012 14:55
Python WeakValueDict text
from weakref import WeakValueDictionary
class A(object): pass
# We want to make sure that the weak value dict loses keys
# that are not referenced anymore
d = WeakValueDictionary()
a = A() ; b = A()
d[id(a)] = a
@sebastien
sebastien / DeathRow-Scraping.ipynb
Created June 18, 2014 13:47
Scraping data from Texas' death row db
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var accents_map = {
"À": "A",
"Á": "A",
"À": "A",
"Â": "A",
"Ã": "A",
"Ä": "A",
"Å": "A",
"Ç": "C",
"È": "E",
#!/usr/bin/env python
# encoding=utf8 ---------------------------------------------------------------
# Project : Enextrcator
# -----------------------------------------------------------------------------
# Author : Sébastien Pierre
# License : BSD License
# -----------------------------------------------------------------------------
# Creation date : 2015-06-22
# Last modification : 2015-06-22
# -----------------------------------------------------------------------------
#!/usr/bin/env python
# encoding=utf8 ---------------------------------------------------------------
# Project : Enextrcator
# -----------------------------------------------------------------------------
# Author : Sébastien Pierre
# License : BSD License
# -----------------------------------------------------------------------------
# Creation date : 2015-06-22
# Last modification : 2015-06-22
# -----------------------------------------------------------------------------

Android & iOS "call-home" workaround

as explained by Matthias Strubel

If you disable mobile access on Android, you can still use an unprepared offline network. If you have mobile networks enabled and connect to a not prepared offline network, the smartphone will fall back to mobile wifi. Sometimes, there is a message, that gives you some chance to use it, but the Samsung phone I had for test purposes denied to work with LibraryBox (which is not prepared yet).

iOS5 or iOS6 introduced a call-home function, that checks for the internet. If it does not receive a specific answer (see below), it opens up a lightweight browser, where you usually can login in hotels (the captive portal). If you don't solve the connection issue with logging in, I think < iOS9 does not fall back to mobile network. I read, that iOS9 will partialle use mobile internet, when the wifi connection is bad. As vague this statement is, so low my knowledge is. Fact is, my prepared PirateBox does not bring my iOS9 iPhone back into mobile n

// title : Pillars
// author : Sébastien Pierre
// license : MIT License
// revision : 0.003
// file : pillars.jscad
// Gist : https://gist.github.com/d0198125390e0d798964
// Preview : http://openjscad.org/#https://gist.githubusercontent.com/sebastien/d0198125390e0d798964/raw/5a4eb71ec5dd64714961fcbeb859d11dee21deb7/pillars.jscad
// Update : gist-pase -u d0198125390e0d798964 pillars.jscad
function getParameterDefinitions() {
#!/usr/bin/env python3
import sys, re, json
__doc__ = """
A basic tool that lists modules imported by require.js
"""
RE_REQUIRE_JS = re.compile("require\s*\(\s*\[(.+)\]", re.MULTILINE)
def list_imports_requirejs( text ):