Skip to content

Instantly share code, notes, and snippets.

;; 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
@novaleksey
novaleksey / peewee_enum.py
Last active January 30, 2022 20:05
Peewee 3 Enum Field Postgres
from peewee import *
database = PostgresqlDatabase(
'my_database',
**{'user': 'postgres', 'password': 'postgres', 'host': 'localhost', 'port': 5432, 'autorollback': True}
)
class BaseModel(Model):
class Meta:
@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 / rounded-box.el
Last active October 3, 2020 13:24
SVG Rounded box for Emacs
(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))
@ivan-krukov
ivan-krukov / emacs-animations.el
Created April 25, 2020 01:19
Emacs-mac animations
;; 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
@jamesmacfie
jamesmacfie / README.md
Created October 22, 2019 02:53
iTerm 2 - script to change theme depending on Mac OS dark mode

How to use

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.

@pvik
pvik / smartparens-cheatsheet.md
Last active March 17, 2024 03:29
A Cheatsheet for Emacs Smarparens example configuration

An animated cheatsheet for smartparens using the example configuration specified here by the smartparens author. Inspired by this tutorial for paredit.

Traversal

C-M-f sp-forward-sexp
C-M-b sp-backward-sexp
@yugaego
yugaego / cert-install.bash
Last active December 28, 2021 16:50
Manage Let's Encrypt Certificate using Certbot with SSL Virtual Hosts
#!/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
@keturn
keturn / fpcursorpagination.py
Last active April 21, 2022 15:21
test for CursorPagination with floating point field
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)
@datacustodian
datacustodian / Document_Conversion.md
Last active December 7, 2023 15:22
Document Conversion

Document Conversion

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".

Document Metadata

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.

Encoding Conversion