Skip to content

Instantly share code, notes, and snippets.

View ncdulo's full-sized avatar
⚙️
The Factory must grow...

ncdulo ncdulo

⚙️
The Factory must grow...
View GitHub Profile
@ncdulo
ncdulo / preview-rst.el
Last active November 12, 2021 02:00 — forked from camsaul/preview-markdown.el
rst-mode live previews
;;; preview-rst.el --- description -*- lexical-binding: t; -*-
;;
;; This file is not part of GNU Emacs.
;;
;;; Commentary:
;;
;; Based on the "Intro To Emacs Lisp: Adding Live Preview when Editing Markdown"
;; guide at the link below. This has been followed along, but re-written to use
;; docutils and rst-mode as I do not have pandoc, nor do I feel I want to deal
;; with installing it and it's many Haskell dependencies.
@ncdulo
ncdulo / deg_to_cardinal.py
Last active March 13, 2020 22:05 — forked from RobertSudwarts/deg_to_cardinal.py
[Python] Degrees to Cardinal direction
def degrees_to_cardinal(degrees):
'''
Return the cardinal direction representing a given 'degrees'
'''
cardinal = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE',
'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW']
cardinal_len = len(cardinal)
ix = round(degrees / (360.0 / cardinal_len))
return cardinal[ix % cardinal_len]