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 / 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 / issue-49.org
Created March 30, 2018 21:37 — forked from wallyqs/issue-49.org
Images with hyperlinks...

Referring to this issue: wallyqs/org-ruby#49

#+html: <img src="https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true&passingText=master%20-%20OK" alt="Project Badge">

Project Badge

#+html: <a href="https://ci.appveyor.com/project/justinjk007/pentagonal-tiling"> <img src="https://ci.appveyor.com/api/projects/status/ldc8jtft09n5997e?svg=true" alt="Project Badge"> </a>
Project Badge
@melioratus
melioratus / asciinator.py
Created October 20, 2017 16:04 — forked from cdiener/asciinator.py
asciinator.py now with documentation
# This line imports the modules we will need. The first is the sys module used
# to read the command line arguments. Second the Python Imaging Library to read
# the image and third numpy, a linear algebra/vector/matrix module.
import sys; from PIL import Image; import numpy as np
# This is a list of characters from low to high "blackness" in order to map the
# intensities of the image to ascii characters
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@'))
# Check whether all necessary command line arguments were given, if not exit and show a
@melioratus
melioratus / language-sampleGrammar.cson
Created September 27, 2017 21:50 — forked from DamnedScholar/language-sampleGrammar.cson
Grammar boilerplate with annotations.
# TextMate tutorial: http://manual.macromates.com/en/language_grammars
# Regex to convert keys to unquoted: '(include|match|captures|begin|end|beginCaptures|endCaptures|name|patterns|0|1|2|3|4|5|6|7|8|9|comment|fileTypes|scopeName|repository|contentName|firstLineMatch|foldingStartMarker|foldingStopMarker)':
scopeName: 'source.<scope>' # <scope> should be a short, unique indicator for the language ("js", "php", "c", etc.)
name: '<name>' # The title that will show up in grammar selection and on your status bar.
fileTypes: [ # An array of file extensions.
'txt'
'exif'
]
@melioratus
melioratus / gist:90252660aa710ef0f5219a1828ce9a33
Last active September 26, 2017 18:52 — forked from rkumar/gist:445735
ruby's OptionParser to get subcommands
#!/usr/bin/env ruby -w
## Using ruby's standard OptionParser to get subcommand's in command line arguments
## Note you cannot do: opt.rb help command
## other options are commander, main, GLI, trollop...
# run it as
# ruby opt.rb --help
# ruby opt.rb foo --help
# ruby opt.rb foo -q
# etc
@melioratus
melioratus / excel_xml_spreadsheet_example.md
Created April 29, 2016 23:47 — forked from ilyazub/excel_xml_spreadsheet_example.md
Excel 2003 XML Spreadsheet example

Excel 2003 XML Spreadsheet example

Solved errors

Problem During Load because of wrong ss:ExpandedRowCount.

If this value is out-of-sync with the table, the specified XML Spreadsheet document is invalid.

Check out XML Spreadsheet Reference for details.

Problem During Load because of empty rows and cells. Check out Table options.