Skip to content

Instantly share code, notes, and snippets.

View delameter's full-sized avatar
🛰️
transmitting

Alexandr Shavykin delameter

🛰️
transmitting
View GitHub Profile

GNU Coding Standards (excerpt)

Standards for Command Line Interfaces

It is a good idea to follow the POSIX guidelines for the command-line options of a program. The easiest way to do this is to use getopt to parse them. Note that the GNU version of getopt will normally permit options anywhere among the arguments unless the special argument -- is used. This is not what POSIX specifies; it is a GNU extension.

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

Unicode sub- and superscripts

\ 0 1 2 3 4 5 6 7 8 9 A B C D E F examples

U+00Bx U+207x U+208x U+209x

⁰ ₀ ₐ

ⁱ ₁ ₑ

²

₂ ₒ

³

₃ ₓ

⁴ ₄ ₔ

⁵ ₅ ₕ

⁶ ₆ ₖ

⁷ ₇ ₗ

⁸ ₈ ₘ

¹ ⁹ ₉ ₙ

⁺ ₊ ₚ

⁻ ₋ ₛ

⁼ ₌ ₜ

⁽ ₍

⁾ ₎

7s² 5f³ 6d¹ x⁽⁷ⁿ⁺ⁱ⁾ H₂SO₄ ⁿCᵣ = ⁿPᵣ/r!

Changing the font size in LaTeX

Changing the font size in LaTeX can be done on two levels, either affecting the whole document or parts/elements of it. Using a different font size on a global level will affect all normal-sized text as well as the size of headings, footnotes, etc. By changing the font size locally, however, a single word, a few lines of text, a large table or a heading throughout the document may be modified.

Changing the font size on a document-wide level

The standard classes, article, report and book support 3 different font sizes, 10pt, 11pt, 12pt (by default 10pt). The font size is set through the optional argument, e.g.:

\documentclass[12pt]{report}
@delameter
delameter / vt100.rst
Last active April 10, 2023 18:06
VT100 escape codes

VT100 escape codes

This document describes how to control a VT100 terminal. The entries are of the form "name, description, escape code".

The name isn't important, and the description is just to help you find what you're looking for. What you have to do is send the "escape code" to the screen. These codes are often several characters long, but they all begin with ^[. This isn't the two characters ^ and [, but rather a representation of the ASCII code ESC (which is why these are called escape codes).

ReStructuredText headers

ReST headers syntax conventions (... is more what you'd call guidelines than actual rules).

git hard-to-remembers

Git command list, which I use infrequently enough to keep forgetting the correct syntax for.

Nginx and Let’s Encrypt with Docker

The Setup

Official images of nginx and an automated build of certbot, the EFF’s tool for obtaining Let’s Encrypt certificates, are available in the Docker library.

Let’s begin with a basic docker-compose.yml configuration file that defines containers for both images:

version: '3'

services:

.gitignore cheatsheet

Git sees every file in your working copy as one of three things:

  1. tracked - a file which has been previously staged or committed;
  2. untracked - a file which has not been staged or committed; or
  3. ignored - a file which Git has been explicitly told to ignore.

Ignored files are usually build artifacts and machine generated files that can be derived from your repository source or should otherwise not be committed. Some common examples are:

Python itertools recipes

import collections
import operator
import random
from itertools import *

def take(n, iterable):
    "Return first n items of the iterable as a list"