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 / uri.js
Created July 14, 2012 09:52 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
>>> import base64
>>> import uuid
>>> u = uuid.uuid4()
>>> print base64.urlsafe_b64encode(u.bytes)[:22]
'1ySOK3mWSWmKOtyNOpDsuQ'
@davidbgk
davidbgk / pr.md
Created September 17, 2012 13:21 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@davidbgk
davidbgk / rss-subscribers.sh
Created September 25, 2012 21:44
Bash script to parse Apache log for a count of RSS subscribers and email it to you
#!/bin/bash
# Schedule this to run once a day with cron. Doesn't matter what time since it parses yesterday's hits (by default).
# I only tested this on the Marco.org server, which runs CentOS (RHEL). No idea how it'll work on other distributions, but it's pretty basic.
# Required variables:
RSS_URI="/rss"
MAIL_TO="your@email.com"
LOG_FILE="/var/log/httpd/access_log"
@davidbgk
davidbgk / thoughts.mdown
Created October 7, 2012 07:59 — forked from karlcow/thoughts.mdown
About interacting with David Thoughts

A small note in David Larlet's thoughts says he is frustrated about not having interactions in his thoughts. Christian Fauré made a comment on twitter about:

  1. Writing in French instead of English.
  2. Having the possibility for comments.

I started to write a tweet for answering to Christian and David and thought, Twitter is not the right place. But I still have a stream of thoughts that I could share. Usenet was quite practical for this in the past. Very handy for sharing thoughts and discussing at the same time without any approval… until the first spam on Usenet, but I digress or more exactly it is too early for this argument.

David: There will always be spam where there is attention (and value).

French or English

@davidbgk
davidbgk / thoughts.mdown
Created October 10, 2012 18:41 — forked from karlcow/thoughts.mdown
About interacting with David Thoughts

Online Discussions And Interactions

License

This document is under CC0 aka equivalent of public domain. People may fork it at will so it will travel through space and time without a precise ownership and might blossom in thousand of branches.

Contributing to this document

You may fork, rewrite a poem, take a stroll and make a photo album with it, add a comment, it doesn't matter. At least a few branches or outcomes of this document might create something owned by our collective mind more than individual. Maybe it will die, it doesn't matter. It really depends on the desire of the people involved to make it alive.

@davidbgk
davidbgk / new_bashrc.sh
Created October 15, 2012 09:48 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
@davidbgk
davidbgk / parisweb2012.md
Created October 21, 2012 15:05
Retours ParisWeb 2012

Retours ParisWeb 2012

Préambule

Avant tout : merci. Je sais à quel point le boulot d'organisateur est ingrat et chronophage, c'était une réussite autant dans la logistique que dans l'ambiance qui reste non-commerciale (ça parait anodin comme ça mais c'est rare…).

Vous avez pris des risques (mesurés) cette année avec les informelles et je suis très heureux de voir apparaitre ce nouveau format qui me convient davantage.

Mon expérience

<snippet>
<content><![CDATA[
from __future__ import print_function, division, absolute_import, unicode_literals
]]></content>
<tabTrigger>future</tabTrigger>
<scope>source.python</scope>
<description>from future import py3</description>
<!-- see: http://stackful.io/blog/quick-tips-on-making-your-code-python-3-ready/ -->
</snippet>
# -*- coding: utf-8 -*-
import datetime
import os.path
import logging
import cmd
import doko
ROOT_FOLDER = "notes"