Skip to content

Instantly share code, notes, and snippets.


Domi DomiDre

Block or report user

Report or block DomiDre

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
DomiDre /
Last active Nov 20, 2019
Determine from Whatsapp Logs, who has posted how many times 1337 at 13:37 throughout the years
from dataclasses import dataclass
import re, datetime
LEETTIME = "1337"
LEET_HOUR = "13"
datasrc = "./whatsapplog.txt"
scores = {}
class Score:
DomiDre /
Created Aug 20, 2019
Short script to fit a magnetization curve using a Langevin function with log-normal distributed moment
import numpy as np
import lmfit
from numpy.polynomial.hermite import hermgauss
file_path = "./example_data.xye"
savefile_path = './magnetization_fit.dat'
quadrature_degree = 21 # integer number between 2 and 100
# use kB/muB in Langevin function -> mu is in units of Bohr magneton
kB = 1.380649e-23 # J/K
DomiDre / fitGaussian.js
Created Aug 6, 2019
Fit of a Gaussian model to data using the ml-levenberg-marquardt package
View fitGaussian.js
var LM = require('ml-levenberg-marquardt');
var fs = require('fs');
function gaussianFunction([A, mu, sigma, c]) {
return (x) => A * Math.exp(-0.5*((x-mu)/sigma)**2) + c;
fs.readFile('../gaussianData.xye', 'utf8', async function(err, data) {
DomiDre /
Created Aug 6, 2019
A short rust script to execute a fit using the rusfun crate
use ndarray::{array, Array1};
use rusfun::{curve_fit, func1d, size_distribution};
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
fn main() {
// read data
let (x, y, sy) = read_column_file("./gaussianData.xye").unwrap_or_else(|err| {
eprintln!("Error reading data file: {}", err);
DomiDre /
Created Aug 6, 2019
Short script that loads a three-column data file and fits the data to a Gaussian model. Times the execution & plots the result.
import numpy as np
from scipy.optimize import leastsq
import time
# Load data from file
rawdata = np.genfromtxt('./gaussianData.xye')
x = rawdata[:, 0]
y = rawdata[:, 1]
sy = rawdata[:, 2]
DomiDre /
Last active Aug 8, 2019
A quick generation of a Gaussian data with small noise
import numpy as np
x = np.linspace(0, 10, 51)
A = 42
mu = 4.2
sigma = 0.666
c = 10
sig_y = 3*np.ones(len(x)) #np.sqrt(y)
DomiDre /
Created Feb 17, 2018 — forked from staltz/
The introduction to Reactive Programming you've been missing
You can’t perform that action at this time.