Skip to content

Instantly share code, notes, and snippets.

@chrisdone
chrisdone / Dockerfile
Created November 6, 2018 16:25
Dockerfile: Build ghc-prim, integer-gmp and base alone
FROM debian:stretch-slim
MAINTAINER Chris Done
################################################################################
# OS deps
RUN apt-get update && apt-get install -y \
gnupg \
gpgv && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BA3CBA3FFE22B574 \
@chrisdone
chrisdone / rust-writeup.md
Created October 17, 2018 10:07
Rust writeup

Rust notes

Here are the notes I took on approaching writing a project in Rust for the first time, from a Haskeller's perspective.

Conclusions

I didn't have any particular trouble worked with and anticipating the needs of the move semantics of Rust. It's not much unlike the experience of dealing with pure/non-pure code in Haskell; you just

@chrisdone
chrisdone / readme.md
Last active December 7, 2023 16:10
Idea: A web frontend for Emacs via CodeMirror

Idea: A web frontend for Emacs via CodeMirror

This is a discussion/thought-process document with my ideas that I've been adding to recently.

Motivation

Why a web frontend for Emacs?

  1. A web frontend would benefit from being cross-platform in the sense
@chrisdone
chrisdone / gosper hurwitz.txt
Created October 2, 2018 15:41
precise math numerics
Appendix 2
Continued Fraction Arithmetic
by
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define BUFFER_SIZE 8192
size_t process_data(char *text, size_t bytes_read)
{
size_t popCount = 0;
@chrisdone
chrisdone / stack-wrap
Last active August 9, 2018 15:23
Wrap stack with notify send
#!/bin/bash
SECONDS=0
cmd="stack $@"
/home/chris/.local/bin/stack-bin "$@"
result="$?"
if [ "$SECONDS" -gt 0 ]; then
if [ "$result" -eq 0 ]; then
notify-send -u normal -t 1000 "Stack completed successfully" "$cmd"
@chrisdone
chrisdone / limit.sh
Created August 8, 2018 13:56
Set cgroup limits on a process
# Create the group
sudo cgdelete memory:/emacs # Recreating it when making changes seems to help them take effect
sudo cgcreate -g memory:/emacs -t chris:chris
sudo cgset -r memory.swappiness=0 emacs
sudo cgset -r memory.limit_in_bytes=1GB emacs
# Run the process with memory limits
cgexec -g memory:emacs emacs
@chrisdone
chrisdone / review.md
Last active August 14, 2023 23:40
Email message parsing in Haskell in 2018

Email message parsing in Haskell in 2018

Background: I am moving away from GMail to my own Haskell-based server (SMTP receiver/sender, web-based email client, spam filtering, etc.). All email to @chrisdone.com goes through this server (mx.chrisdone.com) as of today, and [email protected] forwards a copy of everything to it.

This is a summary/tracking document of my efforts to simply parse email messages in Haskell for the SMTP receiver.

@chrisdone
chrisdone / output.txt
Created July 1, 2018 10:01
Sift output
sift trace sift-bindings/*/* --flag-binding "ghc-prim GHC.Prim raise#"
Flagged binding: ghc-prim:GHC.Prim.raise#
Used by aeson:Data.Aeson.Encoding.Builder.day
Used by aeson:Data.Aeson.Encoding.Builder.digit
Used by aeson:Data.Aeson.Encoding.Builder.scientific
Used by aeson:Data.Aeson.Encoding.Builder.timeOfDay64
Used by aeson:Data.Aeson.Encoding.Builder.timeZone
Used by aeson:Data.Aeson.Encoding.Builder.twoDigits
Used by aeson:Data.Aeson.Internal.Time.diffTimeOfDay64
Used by aeson:Data.Aeson.Parser.Time.seconds
@chrisdone
chrisdone / sift on base.txt
Created June 29, 2018 14:23
sift on base
Used by base:GHC.Real.ratioZeroDenominatorError
Used by base:GHC.Real.reduce
Used by base:GHC.Real.-
Used by base:GHC.Real.+
Used by base:GHC.Real.*
Used by base:GHC.Real.%
Used by base:GHC.Word.toRational
Used by base:GHC.Real.fromRational
Used by base:GHC.Real.realToFrac
Used by base:GHC.Read.convertFrac