Skip to content

Instantly share code, notes, and snippets.

@creichert
creichert / invalid-status-line.hs
Last active September 30, 2018 03:44
Reproduce http-client "Invalid status line '0'"
#!/usr/bin/env stack
-- stack -v runghc --package connection --package http-client --package http-client-tls
{-# LANGUAGE OverloadedStrings #-}
import Prelude
import Control.Concurrent.Async
import Network.HTTP.Client
import Network.HTTP.Client.TLS
@creichert
creichert / gpg.sh
Created September 27, 2018 04:38 — forked from TheFox/gpg.md
Creating the perfect GPG keypair
#!/usr/bin/env bash
# Original: https://alexcabal.com/creating-the-perfect-gpg-keypair/
KEY=xyz
DATE=$(date +"%Y%m%d")
SCRIPT_BASEDIR=$(dirname "$0")
cd "${SCRIPT_BASEDIR}"
echo "This script is not for use in automation"; echo "Use it step by step"; exit 1
@creichert
creichert / dvc-gnus.el
Last active September 25, 2018 04:44
GNUS inline patch integration for git emails (alternative to gnus-inline-patch)
;;; dvc-gnus.el --- dvc integration to gnus
;; Copyright (C) 2003-2009 by all contributors
;; Author: Matthieu Moy <Matthieu.Moy@imag.fr>
;; Contributions from:
;; Stefan Reichoer <stefan@xsteve.at>
;; DVC is free software; you can redistribute it and/or modify
@creichert
creichert / gnus-article-treat-patch.el
Last active September 25, 2018 04:44
Gnus addon to beautify patch-like emails. This uses a "ft/" prefix for everything to avoid clashing with anything upstream. That prefix can be savely s,ft/,,'d - if this is to be submitted to the gnus developers. (alternative to gnus-inline-patch)
;; credit: https://github.com/redguardtoo/emacs.d
;; Gnus addon to beautify patch-like emails. This uses a "ft/" prefix for
;; everything to avoid clashing with anything upstream. That prefix can be
;; savely s,ft/,,'d - if this is to be submitted to the gnus developers.
(require 'diff-mode)
(add-hook 'gnus-part-display-hook 'gnus-article-treat-patch)
;;; simple-mode-line.el --- Simplified Mode Line for Emacs 24
;; Author: Daehyub Kim <lateau at gmail.com>
;; URL: https://gist.github.com/4511988
;; Version: 0.3
;; Keywords: mode-line, color
;;; Commentary:
;; This simplified mode line is adjusted to *white* themes.
@creichert
creichert / dotemacs.el
Created September 22, 2018 07:27 — forked from k-bx/dotemacs.el
emacs, EtagsSelect, ido-mode, multiple TAGS search and Haskell
(defun my-ido-find-tag ()
"Find a tag using ido"
(interactive)
(tags-completion-table)
(let (tag-names)
(mapatoms (lambda (x)
(push (prin1-to-string x t) tag-names))
tags-completion-table)
(etags-select-find (ido-completing-read "Tag: " tag-names nil nil
(thing-at-point 'word)))))
@creichert
creichert / FfiExample.hs
Created September 22, 2018 06:52 — forked from ijt/FfiExample.hs
Example of calling C from Haskell using the FFI
{-# LANGUAGE ForeignFunctionInterface #-}
-- Simple example of calling C from Haskell.
--
-- $ ghci
-- > :load FfiExample.hs
-- > c_sin pi
-- 1.2246467991473532e-16
--
-- $ ghc --make FfiExample.hs
@creichert
creichert / bash-cheatsheet.sh
Created September 22, 2018 04:45 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@creichert
creichert / mode-line.el
Created September 22, 2018 04:20 — forked from fhdhsni/mode-line.el
my emacs mode line config
(defun mode-line-fill-right (face reserve)
"Return empty space using FACE and leaving RESERVE space on the right."
(unless reserve
(setq reserve 20))
(when (and window-system (eq 'right (get-scroll-bar-mode)))
(setq reserve (- reserve 3)))
(propertize " "
'display `((space :align-to (- (+ right right-fringe right-margin) ,reserve)))
'face face))
(evil-leader/set-key
"e" 'flycheck-next-error
"w" 'flycheck-previous-error
"f" 'projectile-find-file
"prt" 'projectile-regenerate-tags
"c" 'projectile-compile-project
"b" 'projectile-switch-to-buffer
"xc" 'save-buffers-kill-terminal