Skip to content

Instantly share code, notes, and snippets.

View rougier's full-sized avatar
:octocat:

Nicolas P. Rougier rougier

:octocat:
View GitHub Profile
@rougier
rougier / mastodon-tl-alternative.el
Last active July 24, 2023 16:13
A different timeline layout for the Emacs mastond client
;;; init-mastodon.el --- Mastodon layout mockup -*- lexical-binding: t -*-
;; Copyright (C) 2022 Nicolas P. Rougier
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
@rougier
rougier / clean.el
Created May 10, 2020 02:43
A very minimal but elegant emacs configuration file
(require 'org)
(setq-default indent-tabs-mode nil)
(setq org-display-inline-images t)
(setq org-redisplay-inline-images t)
(setq org-startup-with-inline-images "inlineimages")
(setq default-frame-alist
(append (list '(width . 72) '(height . 40))))
@rougier
rougier / multiline-header.el
Created June 3, 2020 06:13
Emacs Multiline mode-line
;; -------------------------------------------------------------------
;; A proof of concept for a multi header or mode line
;;
;; Multi line header or mode line is made possible by generating an
;; SVG image made of two small lines of text. It is certainly memory
;; hungry but it seems to be fast enough to display line/column while
;; typing text. It can probably be extended in a number of ways.
;;
;; Feel free to modify it for your own needs.
;; -------------------------------------------------------------------
@rougier
rougier / progress_bar.py
Created January 25, 2016 06:25
A progress bar using unicode character for smoother display
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Nicolas P. Rougier
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
import sys, math
def progress(value, length=40, title = " ", vmin=0.0, vmax=1.0):
"""
Text progress bar
@rougier
rougier / binomial.py
Created January 25, 2016 09:50
A fast way to calculate binomial coefficients in python (Andrew Dalke)
def binomial(n, k):
"""
A fast way to calculate binomial coefficients by Andrew Dalke.
See http://stackoverflow.com/questions/3025162/statistics-combinations-in-python
"""
if 0 <= k <= n:
ntok = 1
ktok = 1
for t in xrange(1, min(k, n - k) + 1):
ntok *= n
@rougier
rougier / style.css
Created June 23, 2021 10:00
Jupyter stylesheet
@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@300;400&family=Source+Code+Pro:wght@300;400&display=swap');
.rendered_html h1,
.rendered_html h2,
.rendered_html h3,
.rendered_html h4 {
color: #000099;
font-weight: 400;
}
@rougier
rougier / org-calendar.el
Created January 6, 2023 18:11
Emacs / Generate a month view
(defun org-calendar-face (date)
'default)
(defun org-calendar-generate-month (year month)
(let* ((first (calendar-day-of-week (list month 1 year)))
(first (+ (mod (+ (- first 1) 7) 7) 1)) ;; Week starts on Monday
(last (+ first (calendar-last-day-of-month month year)))
(days ""))
(dotimes (row 6)
(dotimes (col 7)
@rougier
rougier / nano.el
Created October 2, 2020 17:44
A very minimal emacs configuration
;; nano.el -- A very minimal emacs
;; Usage: emacs -q -l nano.el
;;
;; Copyright (C) 2020 Nicolas .P Rougier
;;
;; Author: Nicolas P. Rougier <nicolas.rougier@inria.fr>
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
@rougier
rougier / folding-box.el
Created November 21, 2022 19:01
An emacs folding box function
(defun folding-box (content &optional size title prefix type folded)
"Enclose TEXT with a box of given SIZE with an optional TITLE at
the top.
If a PREFIX is given, it is prepended to the box such that total
size is enforced, including prefix. If a title is given, the
content of the box can be shown/hidden by clicking on the title
and initial state is specified with FOLDED. The type of the box
can be either 'unicode or 'ascii."
@rougier
rougier / gist:de8643f43d05fd8514912198d21a212e
Created November 18, 2022 12:03
Emacs Mastodon client mockup
;;; init-mastodon.el --- Mastodon layout mockup -*- lexical-binding: t -*-
;; Copyright (C) 2022 Nicolas P. Rougier
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.