Skip to content

Instantly share code, notes, and snippets.

View melioratus's full-sized avatar
💭
Inside emacs

Brian Smith melioratus

💭
Inside emacs
View GitHub Profile
@melioratus
melioratus / npm-using-https-for-git.sh
Created June 24, 2020 15:27 — forked from taoyuan/npm-using-https-for-git.sh
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@melioratus
melioratus / org-mode-syntax-superscripts-and-subscripts-example-1.org
Last active July 20, 2023 15:33
org-mode syntax - superscripts and subscripts example 1

org-mode syntax - superscripts and subscripts example 1

  • Add #+OPTIONS: ^:{} to your org-mode file to explicitly enable superscripts and subscripts.
superscripts
To create a superscript put ^{ characters at the start of the superscript text and } at the end of the superscript text, e.g. word^{superscript} will render as wordsuperscript.
subscripts
To create a subscript put _{ characters at the start of the subscript text and } at the end of the subscript text, e.g. word_{subscript} will render as wordsubscript.

References

@melioratus
melioratus / ClassLoaderLeakExample.java
Created November 12, 2018 15:42 — forked from dpryden/ClassLoaderLeakExample.java
Example of a ClassLoader leak in Java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
background: repeat url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/7QCIUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGscAVoAAxslRxwCAAACAAAcAnQAV8KpIENoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbGQgLSBodHRwOi8vd3d3LnJlZGJ1YmJsZS5jb20vcGVvcGxlL0NoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAA
@melioratus
melioratus / main.el
Created July 3, 2018 17:59
Emacs Lisp script skeleton
#!/bin/sh
":"; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; lexical-binding: t; -*-
(let ((greeting "Hello %s!")
options-done
names)
(pop argv) ; Remove the -- separator
(while argv
(let ((option (pop argv)))
(cond
@melioratus
melioratus / gist:1451a9c920852eb0f59cd398227e5653
Created June 19, 2018 15:39 — forked from jgarvin/gist:ce37d08654978fd7e4c9
Implementation of minibuffer 'belts'
(require 'cl) ;; defstruct
;; TODO: overwrite existing characters, don't erase the
;; whole buffer everytime. And only update things that
;; are actually different.
(defvar md-belt-item-max 8)
(defvar md-current-message nil)
(defvar md-message-counter 0)
(defvar md-num-belts 3)
@melioratus
melioratus / org-ruby-issue-48-workaround.org
Last active October 13, 2019 14:52
Using org-ruby support for inline HTML as workaround for rendering issues

Workaround for org-ruby Issue 48

  • org-ruby supports inline #+HTML:
    #+HTML: <code>C-'</code> (<code>ivy-avy</code>)
        

    which renders as

    C-' (ivy-avy)

Code Text Markup Does Not Render as Expected

~C-'~ does not render to <code>C-'</code>

i.e. ~C-‘~

Unfortunately, this is also true for all text markup for this specfic string.

e.g.

To display verbatim (=) or code (~) syntax characters in org-mode

  • To display verbatim syntax wrap string in code syntax.
    =verbatim=  becomes ~=verbatim=~
        

    verbatim becomes =verbatim=

  • To display code syntax wrap string in verbatim syntax.