Skip to content

Instantly share code, notes, and snippets.

@mbrucher
mbrucher / clang-format-diff.py
Created May 18, 2022 10:25
Format with clang-format when committing with git
#!/usr/bin/env python
#
#===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
@mbrucher
mbrucher / astro.py
Created April 4, 2022 21:46
Small script to stack astro photos
# -*- coding: utf-8 -*-
import glob
import sys
import numpy as np
from PIL import Image
def readFiles(images):
loaded = [np.asarray(Image.open(img)) for img in images]
return np.array(loaded)
*
Vin Vin 0 AC 1
*
* Put here your favorite amp model
Z3b 2 Vin Vout
R044 2 Vout 220k
* Gyrator
C034 2 3 0.027u
@mbrucher
mbrucher / perfect_gyrator.py
Created October 13, 2019 21:06
Comparison of a resistor + coil vs a perfect gyrator
import numpy as np
from scipy.signal import freqs
import matplotlib.pyplot as plt
c = 47.0e-9
r1 = 2.2e3
r2 = 100.0e3
a1 = [1.]
<html>
<head>
<title></title>
<link rel="stylesheet" href="/static/main.css?lang=fr">
</head>
<body>
<center><div id="map-canvas" style="width:70%;height:500px"></div></center>
<script src="/static/map.js?lang=fr" type="text/javascript"></script>
<script type="text/javascript">
@mbrucher
mbrucher / minst_autoencoder_classifier.ipynb
Created November 18, 2018 14:02
A mix of autoencoder and a classifier with Tensorflow
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mbrucher
mbrucher / deploy.py
Created August 16, 2016 12:29
Python 3 64bits deployment script
# Almost copied entirely from http://www.clemens-sielaff.com/creating-your-own-python-3-redistributable-on-windows/
import os, sys
from glob import glob
from shutil import copy, copytree
RELEASE = 1
DEBUG = 2
def find_visual_studio():
// You need to setup memory, how the parameter is updated
// you need to setup max_interval_process, the number of samples before the next update
class ProcessingClass
{
double parameter_target;
double parameter_current;
int64_t interval_process;
public:
@mbrucher
mbrucher / broadcastertest.cpp
Last active November 9, 2015 10:31
Asynchronous reading and writing partitioned data
/**
*
*/
#include "parallelpropertybroadcaster.h"
#include <iostream>
#include <cstdlib>
#include <unistd.h>
#include <fcntl.h>
@mbrucher
mbrucher / simulate_annuity.py
Created August 29, 2015 18:18
Proper simulation of annuities
#!/usr/bin/env python
def simulate_annuity(amount, annuity, month_mean_interest, month_scale_interest):
import numpy as np
months = []
while amount > 0:
months.append(amount)
if month_scale_interest: