Skip to content

Instantly share code, notes, and snippets.

View maxgfr's full-sized avatar
🎯
Focusing

Maxime Golfier maxgfr

🎯
Focusing
View GitHub Profile
@maxgfr
maxgfr / data_loaded_tensorflow.py
Last active March 8, 2018 09:47
Load data on tensorflow
"""
From Jeremie :)
"""
from __future__ import print_function
import numpy
import tensorflow as tf
rng = numpy.random
@maxgfr
maxgfr / basic_cnn.py
Last active March 8, 2018 09:47
CNN on tensorflow
"""
From Jeremie :)
"""
from __future__ import print_function
import numpy
import tensorflow as tf
rng = numpy.random
@maxgfr
maxgfr / kubernetes_cloudant.yaml
Last active March 21, 2018 10:11
Kubernetes & Cloudant
kind: PersistentVolume
apiVersion: v1
metadata:
name: cloudant-pv
labels:
app: microprofile-app
spec:
capacity:
storage: 4Gi
accessModes:
@maxgfr
maxgfr / kafka_mac_os_x.md
Last active May 22, 2019 14:38
Kafka on mac os X

Kafka on mac os X

brew install kafka
brew install zookeeper
zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties
kafka-server-start /usr/local/etc/kafka/server.properties
kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
kafka-console-producer --broker-list localhost:9092 --topic test
kafka-console-consumer --bootstrap-server localhost:9092 --topic test --from-beginning
@maxgfr
maxgfr / socket_express_react.js
Last active April 8, 2020 16:02
Socket.io + Express JS + React JS
var socket = require('socket.io');
var express = require('express');
var app = express();
var path = require('path');
app.use(express.static(path.join(__dirname, 'build')));
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
@maxgfr
maxgfr / node_websocket_kraken.js
Created May 20, 2020 17:02
Example of node application using kraken websocket
const WebSocket = require('ws');
const ws = new WebSocket('wss://ws.kraken.com');
ws.on('open', function open() {
ws.send(JSON.stringify({
"event": "subscribe",
"pair": [
"BTC/USD",
"ETH/USD",
@maxgfr
maxgfr / overlay_container.js
Created July 17, 2020 19:27
Make our own convenient OverlayContainer. The trick is to use absolute with 100% size (cf : https://github.com/onmyway133/blog/issues/254)
// @flow
import React from 'react'
import { View, StyleSheet } from 'react-native'
type Props = {
behind: React.Component,
front: React.Component,
under: React.Component
}
@maxgfr
maxgfr / axios_interceptor.js
Created August 22, 2020 18:32
Axios interceptor
import axios from 'axios'
import store from './redux/store'
const AxiosInstance = axios.create()
AxiosInstance.interceptors.response.use(
(response) => {
return response
},
async function (error) {
@maxgfr
maxgfr / transformFirestoreTypes.ts
Created August 28, 2020 19:57
Transform Firestore Types
const transformFirestoreTypes = (obj: any): any => {
Object.keys(obj).forEach(key => {
if (!obj[key]) return
if (typeof obj[key] === 'object' && 'toDate' in obj[key]) {
obj[key] = obj[key].toDate().getTime()
} else if (obj[key].constructor.name === 'GeoPoint') {
const { latitude, longitude } = obj[key]
obj[key] = { latitude, longitude }
} else if (obj[key].constructor.name === 'DocumentReference') {
const { id, path } = obj[key]