Skip to content

Instantly share code, notes, and snippets.

View PageotD's full-sized avatar

Damien Pageot PageotD

View GitHub Profile
@PageotD
PageotD / main.yaml
Created December 4, 2021 18:41
Simple Ansible role: Grafana
---
- name: 'Install Grafana dependencies'
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- gnupg2
state: 'present'
@PageotD
PageotD / vigenre.py
Created December 31, 2021 09:53
The Vigenère cipher
#!/usr/bin/python
def chartable():
"""
Define universe, i.e the character table available for encryption and decryption
"""
universe = " " # space character
universe += "0123456789" # numbers
universe += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" # letters
universe += "!#$%&'()*+,-./:;<=>?@[\]^_`{|}" # special characters
@PageotD
PageotD / eikonal.py
Last active August 6, 2024 19:26
Eikonal
import heapq as hq
import numpy as np
import numpy.ma as ma
class Eikonal:
"""
Eikonal solver.
References
----------
@PageotD
PageotD / voronoi.py
Last active January 25, 2022 14:35
Voronoi map
import numpy as np
def voronoi(nx, ny, dh, xp, yp, val, xrng, yrng):
"""
Simple Voronoi 2D interpolation.
:param n1: number of points in the first dimension of the output model
:param n2: number of points in the second dimension of the output model
:param dh: spatial sampling
:param xp: x-coordinates of points to interpolate
@PageotD
PageotD / neighborhood.py
Created January 19, 2022 12:06
Sambridge's Neighborhood Algorithm (Coffee Break Scripting)
import matplotlib.pyplot as plt
import numpy as np
def voronoi(nx, ny, dh, xp, yp, val, xrng, yrng):
"""
Simple Voronoi 2D interpolation.
:param n1: number of points in the first dimension of the output model
:param n2: number of points in the second dimension of the output model
:param dh: spatial sampling
@PageotD
PageotD / gpdcwrap.py
Created May 16, 2022 18:16
Wrap for Geopsy-GPDC
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Filename: gpdcwrap.py
# Author: Damien Pageot
# ------------------------------------------------------------------
"""
Functions to use the Geopsy-gpdc engine.
"""
@PageotD
PageotD / pomodoro.py
Last active June 22, 2022 18:53
A simple Pomodoro script in Python
import time
import chime
from rich.progress import Progress
def ptimer(phase, ptime, pcolor="white"):
"""
A generic timer for the three phases of the pomodoro
technique.
phase: (str) name of the phase
@PageotD
PageotD / CBcolors.py
Created December 14, 2022 19:30 — forked from thriveth/CBcolors.py
A color blind/friendly color cycle for Matplotlib line plots. Might want to shuffle it around a bit more,but already not it gives kinda good contrasts between subsequent colors, and shows reasonably well in colorblind filters (though not in pure monochrome).
CB_color_cycle = ['#377eb8', '#ff7f00', '#4daf4a',
'#f781bf', '#a65628', '#984ea3',
'#999999', '#e41a1c', '#dede00']
@PageotD
PageotD / 2020.08-D.Quah-Pandoc-Workflow-Markdown-PDF.md
Created January 20, 2024 17:29 — forked from DannyQuah/2020.08-D.Quah-Pandoc-Workflow-Markdown-PDF.md
My Pandoc Markdown-PDF Workflow for Routine, Not Especially Technical Writing

My Pandoc Markdown-PDF Workflow for Routine, Not Especially Technical, Writing

by Danny Quah, Aug 2020 (revised Jan 2022)

TL;DR: I write technical articles in LaTeX. But shorter, non-technical writings are easier to do in Markdown. How do I produce PDF from Markdown documents? Answer: provide YAML information in the Markdown; run Pandoc (typically through a Makefile or Atom's Markdown Preview Enhanced). To make all this work, some adjustment is needed in Pandoc options and template files.

Pandoc is a filter that takes a written document in a particular format, and produces a version of that same document in yet a different format. I use Pandoc primarily to transform Markdown documents to PDF, but I also draw on Pandoc to convert Word or ODT documents to Markdown. And vice versa.

Available official Pandoc documentation is voluminous. So as a matter of logic the knowledge to generate PDF from Markdown, to the user's desired degree of control, is already extant, out there somewhere. But a user j

@PageotD
PageotD / Dockerfile
Created July 31, 2024 15:29
Simple SQLite Docker image
# Dockerfile for SQLite
FROM alpine:latest
# Install SQLite
RUN apk --no-cache add sqlite sqlite-dev
# Set the working directory
WORKDIR /data
# Expose the port SQLite may use