Skip to content

Instantly share code, notes, and snippets.

@killdash9
killdash9 / HttpServerInEDSAC.eds
Created April 22, 2019 22:21
HTTP Server written in EDSAC assembly
[This is a minimal HTTP server written in EDSAC assembly.
It uses initial orders 1
The program itself starts on line 31 to align instructions with their resident memory addresses
It will run in the great EDSAC simulator found at
http://nhiro.org/learn_language/repos/EDSAC-on-browser/index.html]
@killdash9
killdash9 / mu4e-html-images.el
Created March 23, 2018 23:47
Mu4e HTML images are not shown by default. This gives you a way to toggle them on.
;; mu4e toggle html images
(defvar killdash9/mu4e~view-html-images nil
"Whether to show images in html messages")
(defun killdash9/mu4e-view-toggle-html-images ()
"Toggle image-display of html message."
(interactive)
(setq-local killdash9/mu4e~view-html-images (not killdash9/mu4e~view-html-images))
(message "Images are %s" (if killdash9/mu4e~view-html-images "on" "off"))
(mu4e-view-refresh))
@killdash9
killdash9 / httpserver.sh
Last active February 26, 2018 01:44
A minimal HTTP server in bash that listens on port 1234
#!/bin/bash
#Serves the current directory.
test -p .f||mkfifo .f;while :;do cat .f|nc -l ${1:-1234}|(read m u p;echo $u;u=${u#/};{ echo -e 'HTTP/1.0 200 OK\nContent-type:text/html\n';test -d $u&&ls $u|sed "s,.*,<a href=\"$u/&\">&<br>,"||cat $u;}>.f);done
@killdash9
killdash9 / patch-function.el
Last active February 4, 2017 08:31
When emacs advice is not enough. Redefine builtin functions using search and replace.
(defun patch-function (func-symbol regexp rep)
"Redefine the function given by FUNC-SYMBOL by replacing all
occurrences of REGEXP with REP in its source definition. The
function is evaluated with the changes and then reverted to its
original form so that the original source code file is left
unmodifed. This makes `patch-function' idempotent.
REGEXP is a regular expression to search for in FUNC-SYMBOL's
definition.
@killdash9
killdash9 / vulture-nethack-mac-build.sh
Last active February 17, 2023 08:12
Build vulture nethack from source on Mac OSX. Place this file in the base of the vulture nethack source code and run it.
# Step 1: Install the following 3rd party prerequisites, you can get these from macports:
#
# sudo port install libpng
# sudo port install libsdl_ttf
# sudo port install libsdl_mixer
#
# Step 2: Download and unzip Vulture Nethack source from http://www.darkarts.co.za/vulture-for-nethack
#
# Step 3: Place this file at the base of the unzipped vulture nethack source directory, and run it:
# sh vulture-nethack-mac-build.sh
@killdash9
killdash9 / atari-theme.el
Last active August 23, 2017 17:05
A theme to make your emacs look, feel and sound like 8-bit Atari basic
;; For best results, run this after installing the Atari Classic Chunky font from
;; http://members.bitstream.net/marksim/atarimac/fonts.html
(deftheme atari
"Atari 800 Color Theme")
(defun atari-click ()
"Play the Atari Basic click"
(when (symbolp this-command)
(let ((c (symbol-name this-command)))
@killdash9
killdash9 / gist:8ed18375617e3d2f9371
Created September 26, 2014 16:29
Keep emacs from zoning when under battery power
(require 'battery)
(defadvice zone (around zone-dont-run-on-battery activate)
"Only zone when under power"
(when (equal (cdr (assoc ?L (funcall battery-status-function))) "AC")
ad-do-it))