In iTerm2, in the menu bar go to Scripts > Manage > New Python Script
Select Basic. Select Long-Running Daemon
Give the script a decent name (I chose auto_dark_mode.py
)
Save and open the script in your editor of choice.
;; Taken from https://andreyor.st/posts/2020-05-10-making-emacs-tabs-look-like-in-atom/ | |
;; https://github.com/andreyorst/dotfiles/blob/740d346088ce5a51804724659a895d13ed574f81/.config/emacs/README.org#tabline | |
(defun my/set-tab-theme () | |
(let ((bg (face-attribute 'mode-line :background)) | |
(fg (face-attribute 'default :foreground)) | |
(hg (face-attribute 'default :background)) | |
(base (face-attribute 'mode-line :background)) | |
(box-width (/ (line-pixel-height) 4))) | |
(set-face-attribute 'tab-line nil |
from peewee import * | |
database = PostgresqlDatabase( | |
'my_database', | |
**{'user': 'postgres', 'password': 'postgres', 'host': 'localhost', 'port': 5432, 'autorollback': True} | |
) | |
class BaseModel(Model): | |
class Meta: |
;; 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 |
(require 'svg) | |
;; Rounded boxes using SVG: | |
;; This could be made into a function but size of text needs to be computed | |
(defun tag (text &optional foreground background font-size) | |
(let* ((font-size (or font-size 12)) | |
;; The char-width ratio depends on the font family | |
(char-width (* font-size 0.58)) | |
(char-height (+ font-size 1)) |
;; animations | |
;; Requires =emacs-mac= fork | |
;; repo: https://bitbucket.org/mituharu/emacs-mac | |
;; homebrew tap: https://github.com/railwaycat/homebrew-emacsmacport | |
;; Crazy example | |
(mac-start-animation nil :type 'page-curl-with-shadow | |
:duration 1.0 :direction 'right :angle 45) | |
;; Less crazy | |
(mac-start-animation (selected-window) :type 'move-out |
An animated cheatsheet for smartparens using the example configuration specified here by the smartparens author. Inspired by this tutorial for paredit.
C-M-f | sp-forward-sexp |
C-M-b | sp-backward-sexp |
#!/usr/bin/env bash | |
# Setup custom SSL virtual host with Lets Encrypt certificate | |
# In /etc/httpd/conf.d/ssl.conf add line 'IncludeOptional conf.d/ssl/*.host' | |
searchDir=../path/to/dir/with/domain/names/to/setup | |
hostsDir=/etc/httpd/conf.d/ssl | |
documentRoot=../path/to/www/dir | |
certNotificationsEmail=some@email.dev | |
dbConfig=../path/to/db/config.file |
class FloatingPointCursorPagination(CursorPagination): | |
__rounding_down = decimal.Context(prec=14, rounding=decimal.ROUND_FLOOR) | |
__rounding_up = decimal.Context(prec=14, rounding=decimal.ROUND_CEILING) | |
def _get_position_from_instance(self, instance, ordering): | |
field_name = ordering[0].lstrip('-') | |
if isinstance(instance, dict): | |
attr = instance[field_name] | |
else: | |
attr = getattr(instance, field_name) |
This document outlines some ideas for document conversion on Linux and Mac OS X platforms using command line tools. Distribute documents as plain text using UTF-8 encoding whenever possible. Everyone should embrace the mantra "plain text is beautiful".
Use file
command to obtain basic metadata for most file formats. For image files make sure you have ImageMagick installed, then use identify
command to extract image metadata.