Instantly share code, notes, and snippets.

😃

# DomiDomiDre

😃
• Sort options
Last active Nov 20, 2019
Determine from Whatsapp Logs, who has posted how many times 1337 at 13:37 throughout the years
View score1337.py
 from dataclasses import dataclass import re, datetime LEETTIME = "1337" LEET_HOUR = "13" LEET_MINUTE = "37" datasrc = "./whatsapplog.txt" scores = {} class Score:
Created Aug 20, 2019
Short script to fit a magnetization curve using a Langevin function with log-normal distributed moment
View fit_lognormal_magnetization.py
 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
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) {
Created Aug 6, 2019
A short rust script to execute a fit using the rusfun crate
View main.rs
 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); std::process::exit(1);
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.
View fit_Gaussian.py
 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]
Last active Aug 8, 2019
A quick generation of a Gaussian data with small noise
View generate_randomized_Gaussian.py
 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)
Created Feb 17, 2018 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md

## The introduction to Reactive Programming you've been missing

(by @andrestaltz)

### This tutorial as a series of videos

If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.

You can’t perform that action at this time.