Skip to content

Instantly share code, notes, and snippets.

View python-versions-installation.md

Prerequisities:

  • A reasonably new Ubuntu or Ubuntu-derived system. This helps matching the required system packages to be installed, that are used to build Python form source later on.
  • Single user usage of Python packages. That is, you are not the system administrator that installs packages for multiple users.
  1. Don't use sudo to install Python or a Python packages. There is no need for it, and it can only mess up your system. sudo is only to be used to update the system, or install helper packages (libraries, compilers) to build Python or any package (such as NUmPy) from source, through the system package manager (such as apt, dnf or pacman).

That also means there is no need to install (system) packages such as python(3)-numpy or python(3)-scipy, or even python(3)-pip. In fact, these could possibly even be uninstalled, and no harm would come from it. But if they are installed, let them be. They should not interfere with user-installed versions later on.

  1. Virtual environments are onl
View config.toml
# Notes about values in the TOML config file:
# - strings should always be quoted. Multi-line strings are possible
# using triple-quotes, but should not be necessary in this config file
# - floating point values require a decimal dot, or an exponent (or
# both). Otherwise, they are interpreted as integers.
# More information about the TOML config format: https://github.com/toml-lang/toml
# Scenarios to use.
# This defines only the names and epoch.
@evertrol
evertrol / julia_comprehension_generator_examples.txt
Last active Feb 6, 2020
Julia array / list comprehension and generator expression examples
View julia_comprehension_generator_examples.txt
julia> VERSION
v"1.3.0"
julia> # Julia documention on array) comprehensions and generator expressions:
julia> # https://docs.julialang.org/en/v1/manual/arrays/#Comprehensions-1
julia> # https://docs.julialang.org/en/v1/manual/arrays/#Generator-Expressions-1
julia> # The code below uses generator expressions
julia> # Double list comprehension for the first fifty-one terms of the power series of the exponential function
julia> sum(prod(1/i for i in 1:n) for n in 1:50) + 1
@evertrol
evertrol / environment.yml
Last active Jun 24, 2019
Rhine temperature response
View environment.yml
name: base
channels:
- conda-forge
- defaults
dependencies:
- iris=2.2.0=py36_1003
- iris-sample-data=2.1.0=py_0
- cftime=1.0.3.4=py36hd352d35_1001
- numpy=1.16.2=py36_blas_openblash1522bff_0
- pandas=0.23.4=py36h637b7d7_1000
View main_log_debug.txt
2018-10-16 08:43:28,966 UTC [50059] INFO esmvaltool._main:123
______________________________________________________________________
_____ ____ __ ____ __ _ _____ _
| ____/ ___|| \/ \ \ / /_ _| |_ _|__ ___ | |
| _| \___ \| |\/| |\ \ / / _` | | | |/ _ \ / _ \| |
| |___ ___) | | | | \ V / (_| | | | | (_) | (_) | |
|_____|____/|_| |_| \_/ \__,_|_| |_|\___/ \___/|_|
______________________________________________________________________
ESMValTool - Earth System Model Evaluation Tool
View Rust Fibonacci one-liner
/// Rust Fibonacci one-liner using `fold`
///
/// Not very practical: only for one time use,
/// since it will have to re-calculate all terms again and again
/// if used in a loop to create multiple items.
/// The use of `_` also suggests this is not an ideal solution.
fn main() {
let n = 10;
let x = (0..n).fold((0, 1), |x, _| (x.0+x.1, x.0)).0;
println!("{}: {}", n, x);
View sims-classification.html
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<title>Thumbnail classification</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<style type="text/css">
/*!
*
@evertrol
evertrol / Makefiles.md
Last active Mar 21, 2022
Makefile cheat sheet
View Makefiles.md

Makefile cheat sheet

Mostly geared towards GNU make

I've used ->| to indicate a tab character, as it's clearer to read than

  • Set a target, its dependencies and the commands to execute in order
target: [dependencies]
-&gt;| 
View astrometry-gone-wrong.md

Astrometry gone wrong

SExtractor (source extractor) is a convenient tool to run on a FITS image and return a bunch of detected sources, with their fluxes and magnitudes. Unfortunately, being written quite a while ago, it hasn't fully kept up-to-date with developments in astrometry, in particular the introduction of Simple Imaging Polynomial (SIP) corrections. SExtractor uses an older style WCS correction, which has become abandoned over the years, not least because of the avaibility of Astrometry.net (which uses SIP corrections).