Skip to content

Instantly share code, notes, and snippets.

View eunomie's full-sized avatar
🐳

Yves Brissaud eunomie

🐳
View GitHub Profile
@eunomie
eunomie / G.js
Created April 17, 2012 14:38
inconsistent code style
/**
* @param {*} input to create the G with.
* @param {string|Element|Node=} opt_mod elemnt to look under.
* @constructor
* @return {G} the G object.
*/
G = function(input, opt_mod) {
if (input.constructor == G) // if with one statement and no {}
return /** @type {G} */(input);
if (goog.isString(opt_mod)) { // if with one statement but {}
@eunomie
eunomie / gist:4771409
Last active December 12, 2015 12:19
Mac setup from scratch (just a list of softwares to install)
@eunomie
eunomie / m.js
Last active December 16, 2015 05:58
Markdown
h = document.getElementsByTagName('head')[0]
m = document.createElement('script'); m.src="https://pagedown.googlecode.com/hg/Markdown.Converter.js";h.appendChild(m)
document.body.innerHTML = '<table><tr><td contenteditable></td><td></td>'
a = document.createElement('style'); a.appendChild(document.createTextNode('table {width:100%;height:100%}td{width:50%;overflow:auto}td+td{background:#eeeeec}'));h.appendChild(a)
tds=document.getElementsByTagName('td')
s = tds[0]
p = tds[1]
;(_ = function() {
if (!("Markdown" in window)) {
window.setTimeout(_, 100)
/**
* The default implementation of the import function. Writes a script tag to
* import the script.
*
* @param {string} src The script source.
* @return {boolean} True if the script was imported, false otherwise.
* @private
*/
goog.writeScriptTag_ = function(src) {
if (goog.inHtmlDocument_()) {
/* Javascript plotting library for jQuery, version 0.8.2-alpha.
Copyright (c) 2007-2013 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
// first an inline dependency, jquery.colorhelpers.js, we inline it here
// for convenience
@eunomie
eunomie / change_wallpaper_all_desktops.rb
Created January 30, 2014 09:25
Prend une image aléatoirement dans le répertoire IMAGES et applique là à tous les spaces puis redémarre le Dock pour que ce soit pris en compte. Initialement il faut que tous les spaces aient soient configurés avec une image (pas la conf par défaut).
#!/usr/bin/env ruby
require "sqlite3"
DB_LOC = File.join(ENV["HOME"], "Library/Application Support/Dock/desktoppicture.db")
DB = SQLite3::Database.new(DB_LOC)
IMAGES = File.join(ENV["HOME"], "Pictures/desktops/2560x1600","*")
new_image = Dir[IMAGES].sort_by{ rand }[0]
new_image.sub!(ENV["HOME"],"~")

How To TCP NAT Traversal using Node.js and a STUN Server

With the scarecity of IPv4 addresses, and IPv6 still not available at large, NAT traversal is becoming a necessity. Especially with the generalisation of Carrier-grade NATs that you can find on mobile connections. Even with IPv6 you may suffer NAT66. Imagine your mobile device that gets only a single Ipv6 address, and you want to share it on your computer.

The solution might be in a decentralized protocol for address attribution such

Keybase proof

I hereby claim:

  • I am eunomie on github.
  • I am eunomie (https://keybase.io/eunomie) on keybase.
  • I have a public key ASCIvP3D0xM_hpu_dFfi123J1VnXM-K0GfIo9BC_pRcYAQo

To claim this, I am signing this object:

@eunomie
eunomie / get
Created April 22, 2015 12:24
Some Android shortcuts
#!/bin/sh
adb pull "/data/local/tmp/$1.mp4"
adb shell rm "/data/local/tmp/$1.mp4"
@eunomie
eunomie / README.md
Last active February 11, 2016 11:39
mirabegit: git quetsche --mirabelle
  • put git-quetsche in $PATH
  • run git quetsche --mirabelle => execute git fetch --prune