Skip to content

Instantly share code, notes, and snippets.

@miohtama
miohtama / gist:5389146
Created April 15, 2013 15:56
Decoding emails in Python e.g. for GMail and imapclient lib
import email
def get_decoded_email_body(message_body):
""" Decode email body.
Detect character set if the header is not set.
We try to get text/plain, but if there is not one then fallback to text/html.
:param message_body: Raw 7-bit message body input e.g. from imaplib. Double encoded in quoted-printable and latin-1
@tbnorth
tbnorth / gist:5530059
Last active December 17, 2015 01:39
My leo-editor @settings / @DaTa abbreviations (first) and @settings / @DaTa abbreviations-subst-env (second)
# Comments lines (lines starting with '#') are ignored.
# Non-comment lines should have the form::
#
# name=definition
# Definitions in @data abbreviation nodes override definitions in @data
# global-abbreviation nodes. Typically you would define @data abbreviation nodes
# in myLeoSettings.leo
# jump to and select next placeholder
@GitMurf
GitMurf / obsidian.templater.move-line.js
Last active October 10, 2023 11:56
Move the active line of the active file to a chosen file.
<%*
//v1.6.2: Fix with update to Templater where wasn't removing the selected text/line "on move"
//'first' will add to top of file. 'last' will add to bottom of file
let firstOrLastLine = 'last';
//Choose a specific line to move to underneath; overrules firstOrLastLine if true
const bChooseLine = false;
//After moving the line, open the file it was moved to