| Value | Color |
|---|---|
| \e[0;30m | Black |
| \e[0;31m | Red |
| \e[0;32m | Green |
| \e[0;33m | Yellow |
| \e[0;34m | Blue |
| \e[0;35m | Purple |
| def getchar(): | |
| #Returns a single character from standard input | |
| import tty, termios, sys | |
| fd = sys.stdin.fileno() | |
| old_settings = termios.tcgetattr(fd) | |
| try: | |
| tty.setraw(sys.stdin.fileno()) | |
| ch = sys.stdin.read(1) | |
| finally: | |
| termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) |
| # This is free and unencumbered software released into the public domain. | |
| # | |
| # Anyone is free to copy, modify, publish, use, compile, sell, or | |
| # distribute this software, either in source code form or as a compiled | |
| # binary, for any purpose, commercial or non-commercial, and by any | |
| # means. | |
| # | |
| # In jurisdictions that recognize copyright laws, the author or authors | |
| # of this software dedicate any and all copyright interest in the | |
| # software to the public domain. We make this dedication for the benefit |
| import argparse | |
| from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes | |
| from cryptography.hazmat.primitives import hashes | |
| from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC | |
| from cryptography.hazmat.backends import default_backend | |
| import os | |
| # Constants | |
| SALT_SIZE = 16 | |
| IV_SIZE = 16 |
| # 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 |
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
| CB_color_cycle = ['#377eb8', '#ff7f00', '#4daf4a', | |
| '#f781bf', '#a65628', '#984ea3', | |
| '#999999', '#e41a1c', '#dede00'] |
| 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 |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # ------------------------------------------------------------------- | |
| # Filename: gpdcwrap.py | |
| # Author: Damien Pageot | |
| # ------------------------------------------------------------------ | |
| """ | |
| Functions to use the Geopsy-gpdc engine. | |
| """ |
| 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 |