Skip to content

Instantly share code, notes, and snippets.

View dfroger's full-sized avatar

Froger David dfroger

View GitHub Profile
@dfroger
dfroger / .flowconfig
Last active October 19, 2018 13:14
reproduce a bug in flow (0.83.0 for example)
# empty
@dfroger
dfroger / main.js
Last active December 21, 2017 15:47
dict comprehension
const foo = {
x: {a: 10, b: 1},
y: {a: 20, b: 2},
z: {a: 30, b: 3}
}
const bar = Object.entries(foo).reduce((acc, [key, value]) => ({...acc, [key]: value.a}), {});
console.log(bar); // { x: 10, y: 20, z: 30 }
@dfroger
dfroger / m_coding_rule.py
Created December 14, 2015 10:50
Change coding rules for C++ class member from variable_ to m_variable
"""
In all files passed in argument, change coding rules for C++ class member from
variable_ to m_variable.
"""
import sys
import re
def main():
pattern = re.compile(r'(\b\w+)_\b')
@dfroger
dfroger / vtk_unstructured_grid
Created May 29, 2015 15:43
Read/write VTK files (Unstructured grid with data)
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Read/write VTK files (Unstructured grid with data)"
]
},
{
@dfroger
dfroger / main.py
Last active August 29, 2015 14:19
Automatic detection of required variable to make a restart
class Variable:
"""
Determine required variables to restaure a state:
0: Go to state A
1: Go from state A to state B with an operation O.
2: Dump required variables.
3: Go to state A, and load required variables to be at state B.
4: Go from state B to state C with the same operation O.
"""
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@dfroger
dfroger / metis2.ipynb
Last active August 29, 2015 13:56
Coloring a graph
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dfroger
dfroger / metis1.ipynb
Last active August 29, 2015 13:56
Partionning a triangular mesh using Metis
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dfroger
dfroger / metis0.ipynb
Last active July 10, 2022 10:30
Partionning mesh with Metis.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.