Skip to content

Instantly share code, notes, and snippets.

Avatar
Electrifying my brain

Patrice Ferlet metal3d

Electrifying my brain
View GitHub Profile
View Gonum plot and Lgo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View jplot.go
// Proposes to draw gonum plot on Jupyter using
// the fantastic lgo kernel
package jplot
// You may save that file in $GOPATH/src/jplot/jplot.go
import (
"bytes"
"github.com/yunabe/lgo/core"
View GoPlot.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@metal3d
metal3d / goswitch installation
Created Nov 19, 2017
Install script for goswitch
View goswitch installation
curl -sSL $(curl -s https://api.github.com/repos/metal3d/goswitch/releases/latest | \
grep tarball | cut -d '"' -f 4) | \
tar -zxf - --strip-components=1 -C ~/.local/bin */goswitch
@metal3d
metal3d / OWNERS
Last active Mar 24, 2017
Kubernetes Incubator Proposal - Argoos
View OWNERS
Patrice FERLET aka Metal3d <metal3d@gmail.com> <patrice.ferlet@smile.fr>
View PythonDIPonyTech
# Why DI Framework are useful
Dependency injection is back in fashion. That's probably the result AngularJS, Symfony2, and many Java frameworks success that offer a "DI" implementation. But what is "DI", and why are we able to *not use* "DI" framework with Python ?
## What is dependency injection
Dependency injection is a pattern, or it is rather a way to implement dependencies between classes. The approach is basically to avoid classes to directly instanciate objects, and make use of interfaces and/or factories. That's all, nothing more complicated.
To illustrate the definition, it's simpler to look at an example.
@metal3d
metal3d / gtk.css
Created Feb 9, 2016
Reduct title bar on gnome 3
View gtk.css
/* To put in ~/.config/gtk-3.0/gtk.css */
/* Create directory and file if they don't exist */
/* Change paddings to fill your preferences */
.header-bar.default-decoration {
padding-top: 1px;
padding-bottom: 1px;
}
.header-bar.default-decoration .button.titlebutton {
padding-top: 1px;
padding-bottom: 1px;
@metal3d
metal3d / deploy_coreos_libvirt.sh.patch
Created Feb 1, 2016
Patch to change SELinux context of CoreOS libvirt deployment script
View deploy_coreos_libvirt.sh.patch
diff -up ./deploy_coreos_libvirt.sh.friend ./deploy_coreos_libvirt.sh
diff -up ./deploy_coreos_libvirt.sh.friend ./deploy_coreos_libvirt.sh
--- ./deploy_coreos_libvirt.sh.friend 2016-01-25 14:18:15.431503583 +0100
+++ ./deploy_coreos_libvirt.sh 2016-01-25 14:24:35.942741966 +0100
@@ -51,6 +51,12 @@ for SEQ in $(seq 1 $1); do
sed "s#%HOSTNAME%#$COREOS_HOSTNAME#g;s#%DISCOVERY%#$ETCD_DISCOVERY#g" $USER_DATA_TEMPLATE > $LIBVIRT_PATH/$COREOS_HOSTNAME/openstack/latest/user_data
+
+ if [[ selinuxenabled ]] ;then
View PythonDIArticle.md

Python et l'injection de dépendance

Ah, ça... quand on parle d'injection et de dépendance, on s'attend tout de suite à se prendre une flopée de visiteurs en manque de substance plus ou moins illicites. En réalité, on va parler "pattern". Et surtout, je vais lancer un vieux pavé dans la marre en disant qu'en Python c'est pas super utile, ou du moins que le langage permet déjà de le gérer sans se faire mal.

Piqure de rappel

Conversation un matin au travail:

@metal3d
metal3d / gh_latest.go
Last active Aug 29, 2015
Go client to github to get latest release and assets for a given repository
View gh_latest.go
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
You can’t perform that action at this time.