Skip to content

Instantly share code, notes, and snippets.

#### Some statistical analysis of daily mean temperatures in France
#### See: <URL: https://twitter.com/gro_tsen/status/1620488744867598337 >
## Input data: /tmp/temps.csv is expected to contain a list of daily
## average temperatures in France (first column = date (unused),
## second column = temperature in Celsius), over a whole number of
## calendar years. It can be produced from the data source described
## in <URL: https://twitter.com/gro_tsen/status/1620435663844970497 >
## by the following command line:
19500101 0.7202
19500102 0.6790
19500103 5.4118
19500104 6.8020
19500105 6.4501
19500106 5.4249
19500107 5.0415
19500108 4.9504
19500109 6.3907
19500110 6.5916
/* Compute digits of the (pq)-adic idempotent - David A. Madore, 2014-02-03 */
#include <stdio.h>
#include <string.h>
#include <gmp.h>
#ifndef DIGITS
#define DIGITS 10000000
#endif
## Voir <URL: https://twitter.com/gro_tsen/status/1610641879216914432 > pour le contexte.
## Matrice des contraintes linéaires (la valeur [0] sert à encoder la
## contrainte somme et vaudra 1 sur toute solution, les valeurs [1] à
## [9] sont les cases du tableau avec [1] = nord-ouest, [2] = nord,
## [3] = nord-est, [4] = ouest, [5] = centre, [6] = est, [7] =
## sud-ouest, [8] = sud et [9] = sud-est):
mat = Matrix(ZZ,[(-19,1,1,0,1,1,0,0,0,0),(-19,0,1,1,0,1,1,0,0,0),(-19,0,0,0,1,1,0,1,1,0),(-19,0,0,0,0,1,1,0,1,1)]).transpose()
## Base échelonnée des solutions entières:
## Voir <URL: https://twitter.com/gro_tsen/status/1610641879216914432 > pour le contexte.
## Matrice des contraintes linéaires (la valeur [0] sert à encoder la
## contrainte somme et vaudra 1 sur toute solution, les valeurs [1] à
## [9] sont les cases du tableau avec [1] = nord-ouest, [2] = nord,
## [3] = nord-est, [4] = ouest, [5] = centre, [6] = est, [7] =
## sud-ouest, [8] = sud et [9] = sud-est):
mat = Matrix(ZZ,[(-19,1,1,0,1,1,0,0,0,0),(-19,0,1,1,0,1,1,0,0,0),(-19,0,0,0,1,1,0,1,1,0),(-19,0,0,0,0,1,1,0,1,1),(-45,1,1,1,1,1,1,1,1,1)]).transpose()
## Base échelonnée des solutions entières:
@Gro-Tsen
Gro-Tsen / gettweet.pl
Created January 3, 2023 11:41
Twitter Perl scripts
#! /usr/local/bin/perl -w
# gettweet.pl: Retrieve the content of tweets by id.
# Usage: getweet.pl -i <comma-separated-list>
# saves each in a file called <fulldate>-<id>.txt
# Requires API keys to be stored in ~/.twitterkeys (or $TWITTERKEYS)
# syntax being four lines starting "API-Key: ", "API-Key-Secret: ",
# "Access-Token: " and "Access-Token-Secret: " each followed by their value.
@Gro-Tsen
Gro-Tsen / 20221214-secretary-game.tex
Created December 16, 2022 16:07
A problem in probability
\documentclass[12pt,a4paper]{article} % -*- coding: utf-8 -*-
\usepackage[a4paper,margin=1.5cm]{geometry}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
@Gro-Tsen
Gro-Tsen / ellipse-conformal-map.sage
Created December 15, 2022 16:34
Graphical representation of the Riemann mapping theorem for a square (inside and out) and an ellipse (inside and out)
# Square of eccentricity (but not that of the drawn ellipse):
modparm = 3/4
# The size of the drawn ellipse (semimajor and semiminor) is computed
# below.
### Mapping the inside of the disk to the inside of the ellipse:
prescale = N(modparm^(-1/4))
postscale = N(pi/(2*elliptic_kc(modparm)))
@Gro-Tsen
Gro-Tsen / singular-cubic-surfaces-eqn.txt
Created December 13, 2022 18:02
Equation of the locus of singular cubic surfaces
a030^2*a201^3*a111^4*a021*a102^2
- a120*a030*a201^2*a111^5*a021*a102^2
+ a210*a030*a201*a111^6*a021*a102^2
- a300*a030*a111^7*a021*a102^2
- 8*a030^2*a201^4*a111^2*a021^2*a102^2
+ 8*a120*a030*a201^3*a111^3*a021^2*a102^2
+ a120^2*a201^2*a111^4*a021^2*a102^2
- 10*a210*a030*a201^2*a111^4*a021^2*a102^2
- a210*a120*a201*a111^5*a021^2*a102^2
+ 11*a300*a030*a201*a111^5*a021^2*a102^2
#! /usr/local/bin/perl -w
# A simple Perl program to plot a bunch of points (specified by
# latitude and longitude) on an OpenStreetMap base map.
# This takes a list of points (one per line, latitude and longitude
# separated by whitespace or '/' or ',') and plots them as thick
# points on an OpenStreetMap background, saving the resulting map as a
# PNG file (by default "map.png"). The list of points to plot is read
# from the files passed on the command line or, if there are none,