Skip to content

Instantly share code, notes, and snippets.

@creichert
creichert / gmail_checker.rb
Created November 1, 2018 05:09 — forked from liangzan/gmail_checker.rb
Gmail checker for Xmobar
# Gmail checker for Xmobar
#
# Install the ruby-gmail and mime gem to system
# Put the script under ~/path/to/gmail_checker.rb
# Make sure it is executable
require 'gmail'
gmail = Gmail.new('example@gmail.com', 'password')
mail_count = gmail.inbox.count(:unread)
@creichert
creichert / USAGE.md
Created October 29, 2018 08:31 — forked from mterwill/USAGE.md
Beancount importers, scripts, etc.

Note: everything here is pretty specific to my usage/accounts and not written for public use... You'll probably have to tweak a bunch of stuff.

$ bean-extract config.py ~/Downloads # the csvs should be in here
@creichert
creichert / template.el
Created October 13, 2018 05:23 — forked from cbowdon/template.el
Macro to add string interpolation to Emacs Lisp
(defmacro template (text)
"Expand text like \"Hello <<name>>\" to (format \"Hello %s\" name)."
(let ((pattern "<<\\(.*?\\)>>"))
;; The regexp matches anything between delimiters, non-greedily
(with-temp-buffer
(save-excursion (insert text))
(let ((matches '()))
(while (re-search-forward pattern nil t)
(push (match-string 1) matches)
(replace-match "%s" t t))
@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
;;; 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))
@creichert
creichert / setup-info-gen.hs
Created August 11, 2018 16:39 — forked from DanBurton/setup-info-gen.hs
Generate a stack.yaml that can install ghc-8.6.1-beta1 (aka ghc-8.6.0.20180810)
#!/usr/bin/env stack
{- stack
script
--resolver lts-11.16
--package bytestring
--package http-conduit
-}
-- usage: ./Main.hs
-- modify the baseUrl and ghcDateVersion to taste