Skip to content

Instantly share code, notes, and snippets.

View davidbgk's full-sized avatar
🚪
Let’s escape GAFAM+ when/while we can!

David Larlet davidbgk

🚪
Let’s escape GAFAM+ when/while we can!
View GitHub Profile
@davidbgk
davidbgk / field.html
Created November 9, 2011 01:24 — forked from pydanny/field.html
django-uni-form + Twitter Bootstrap
<!-- this usually goes in <project-root>/templates/uni_form/field.html -->
{% if field.is_hidden %}
{{ field }}
{% else %}
<div class="clearfix {% if field.errors %}error{% endif %}">
<label for="{{ field.auto_id }}" {% if field.field.required %}class="requiredField"{% endif %}>
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
</label>
<div class="input">
@davidbgk
davidbgk / gist:1663311
Created January 23, 2012 14:03
Calcul des + de 20 ans qui ont le bac ou plus en France
Sources:
http://www.insee.fr/fr/themes/tableau.asp?reg_id=0&ref_id=NATTEF07232
http://www.insee.fr/fr/themes/tableau.asp?reg_id=0&ref_id=NATnon02150
population: 100.0% -> 65 000 000
plus de 20: 75.5% -> 49 075 000
age pop bac
15-19 ans 6.0% 0.6% -> 23 400
20-24 ans 6.3% 16.3% -> 667 485
@davidbgk
davidbgk / fabfile.py
Created January 30, 2012 08:08
An example of fabric commands against AlwaysData web hosting
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from cgi import escape
from datetime import date, datetime
import markdown
from fabric.api import run, env
USERNAME = 'larlet'
@davidbgk
davidbgk / Solarized.css
Created February 29, 2012 01:20
A theme for LimeChat IRC client, inspired by Whisper and adapted with Solarized colors. Drop it in ~/Library/Application Support/LimeChat/Themes
html.normal {
color: #4b4b4b;
background-color: white;
font: 14px/1.4em 'Menlo' sans-serif;
margin: 0;
padding: 0;
}
body.normal a img {
border: 0;
@davidbgk
davidbgk / gist:2495085
Created April 26, 2012 01:39 — forked from paulirish/gist:839879
requestAnimFrame() shim.
// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// shim layer with setTimeout fallback
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
@davidbgk
davidbgk / maximum_battery_life.md
Created May 11, 2012 00:18 — forked from asenchi/maximum_battery_life.md
maximum battery life checklist -- use before a long plane flight

Max Battery Life Checklist

Here is a checklist to follow if you want maximum battery life -- for instance if you're about to get on a long plane flight.

10 hour battery life on a non-SSD Macbook Pro 17"

Low power use checklist

With power connected:

@davidbgk
davidbgk / postsql.sql
Created May 17, 2012 23:53 — forked from tobyhede/postsql.sql
PostgreSQL as JSON Document Store
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- JSON Types need to be mapped into corresponding PG types
--
-- Number => INT or DOUBLE PRECISION
-- String => TEXT
@davidbgk
davidbgk / flaskapp.py
Created June 11, 2012 01:01 — forked from kennethreitz/flaskapp.py
My typical flask app base
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask_heroku import Heroku
from flask_sslify import SSLify
from raven.contrib.flask import Sentry
from flask.ext.celery import Celery
@davidbgk
davidbgk / data.md
Created June 24, 2012 00:12 — forked from jordansissel/data.md
Logstash 1.1.1 + ElasticSearch 0.19.5 compression tests

compression tests of logstash+elasticsearch

  • logstash 1.1.1-pre (unreleased)
  • elasticsearch 0.19.5-SNAPSHOT (unreleased)
wget https://dl.dropbox.com/u/2136051/elasticsearch-0.19.5-SNAPSHOT.zip
unzip elasticsearch-0.19.5-SNAPSHOT.zip
@davidbgk
davidbgk / pre-commit.py
Created July 11, 2012 10:02 — forked from streeter/pre-commit.py
Python .git/hooks/pre-commit hook
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [