Skip to content

Instantly share code, notes, and snippets.

Avatar
Electrifying my brain

Patrice Ferlet metal3d

Electrifying my brain
View GitHub Profile
@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;
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 / OWNERS
Last active Mar 24, 2017
Kubernetes Incubator Proposal - Argoos
View OWNERS
Patrice FERLET aka Metal3d <metal3d@gmail.com> <patrice.ferlet@smile.fr>
@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
View GoPlot.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 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.
@metal3d
metal3d / estimator.py
Last active Jun 7, 2018
Sagemaker estimator
View estimator.py
import sagemaker as sage
import boto3
from sagemaker import get_execution_role
role = get_execution_role()
sess = sage.Session()
account = sess.boto_session.client('sts').get_caller_identity()['Account']
region = sess.boto_session.region_name # or setup the region by hand
@metal3d
metal3d / predictor.py
Created Jun 7, 2018
Sagmaker prediction
View predictor.py
from sagemaker.predictor import RealTimePredictor
from sagemaker.predictor import json_serializer
# get the name in SageMaker interface and put it there
endpoint = 'name of your endpoint'
# you can use other serializer, or none if you are able
# to get data in binary format
predictor = RealTimePredictor(endpoint, serializer=json_serializer)
@metal3d
metal3d / dlblender
Created Sep 8, 2018
Download latest Blender builds
View dlblender
#!/bin/env python3
# -*- encoding: utf8 -*-
"""
Download latest build for Blender 2.7x and 2.8x
How to use:
- get that source code and name it "dlblender"
- change vars INSTALL_PATH and LINK_PATH is you want
- INSTALL_PATH is where will reside new and old version of blender.
I'm using hidden path "~/.blender"