Skip to content

Instantly share code, notes, and snippets.

View Klafyvel's full-sized avatar

Hugo LEVY-FALK Klafyvel

View GitHub Profile
@Klafyvel
Klafyvel / export_charts.jl
Created September 12, 2023 08:27
Find charts in a word documents and export them to CSV
using CSV, DataFrames, LightXML, ZipFile
file = first(ARGS)
function forage_child(node, child)
filter(x->name(x) == child, collect(child_elements(node))) |> first
end
function forage_child(node, children...)
n = node
for c in children
module Mockup
abstract type TokenType end
struct AToken <: TokenType end
struct BToken <: TokenType end
struct Token{T <: TokenType}
position::Int
value::Char
end
@Klafyvel
Klafyvel / FixedCosine.ino
Created July 21, 2022 20:54
Fixed-Point representation Trigonometry computations for Arduino.
/*
This is a simple implementation of Cosine and Sine computation using a 16
bits fixed-point representation.
It uses PacketSerial to send data with COBS because I had some issues with
my Arduino, but this is not required.
*/
#include <PacketSerial.h>
typedef uint16_t fixed_t;
/*
Timing 16bits fixed-point multiplications. The technique used is described
here : https://forum.arduino.cc/t/timing-the-little-things/47247
this should print on an arduino Uno:
loops: 39 clocks: 156
*/
#include <FixedPoints.h>
#include <FixedPointsCommon.h>
/*
Timing Float and Long operations. The technique used is described
here : https://forum.arduino.cc/t/timing-the-little-things/47247
For multiplication this should print :
long loops: 64 clocks: 92
float loops: 52 clocks: 115
For addition :
@Klafyvel
Klafyvel / figure.jl
Created January 30, 2022 09:58
Figure for the article in FedeRez's newsletter.
using Statistics
using GLMakie
using LsqFit
using Measurements
## Theming
latextheme = Theme(
font="CMU Bright",
Axis=(
### A Pluto.jl notebook ###
# v0.17.1
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
@Klafyvel
Klafyvel / gaussian_beam_animation.jl
Last active March 21, 2021 15:29
A Pluto.jl notebook to create a gaussian beam animation.
### A Pluto.jl notebook ###
# v0.12.21
using Markdown
using InteractiveUtils
# ╔═╡ 7f410d28-8a42-11eb-0bce-cd33c80b6157
using Plots, LaTeXStrings, Colors
# ╔═╡ 76d912b0-8a57-11eb-1e58-0b070d9bd74b
# Made by Hugo 'klafyvel' Levy-Falk, under MIT License
# Sampling of the square
n_points = 128
# Number of steps in the animation
n_steps = 200
# Framerate of the animation
fps=30