Instantly share code, notes, and snippets.

Philipp Fehre sideshowcoder

View GitHub Profile
View coders-little-helper.el
;;; coders-little-helper -- all kind of helper functions
;;; Commentary:
;; Helper functions for all kind of daily Emacs stuff.
;; Run tests on the command line:
;; emacs -batch -l coders-little-helper.el
;; From inside Emacs
View Makefile
# Use Mermaid ( and Markdown to create word docs
# with diagrams.
# Requires Pandoc and mermaid pandoc filter to process all md files in the
# current folder to html and the html to docx for word
# see
SRC = $(wildcard *.md)
DIA = $(
DOCS = $(DIA:.html=.docx)

Keybase proof

I hereby claim:

  • I am sideshowcoder on github.
  • I am sideshowcoder ( on keybase.
  • I have a public key ASAEE-dQHXaxnF5kXmIlTg3XB_YoqdRpORJs-L2ImDIItgo

To claim this, I am signing this object:

parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
export PS1="\u@\h \w\$(parse_git_branch) \\$ "
View my_funcs.el
;; automatically open a file as sudo unless we have permission to write it
;; already, after all this is my machine and I can do what I want!
(defadvice ido-find-file (after find-file-sudo activate)
"Find file as root if necessary."
(unless (and buffer-file-name
(file-writable-p buffer-file-name))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
View go-guru-scope.el
(defun coder/go-guru-set-current-package-as-main ()
"GoGuru requires the scope to be set to a go package which
contains a main, this function will make the current package the
active go guru scope, assuming it contains a main"
(let* ((filename (buffer-file-name))
(gopath-src-path (concat (file-name-as-directory (go-guess-gopath)) "src"))
(relative-package-path (directory-file-name (file-name-directory (file-relative-name filename gopath-src-path)))))
(setq go-guru-scope relative-package-path)))
View rspec_file.el
(defun coder/rspec-file ()
"Run rspec on the current file and set as the compile target,
if we have zeus available than run it via zeus otherwise run it
via bundle exec rspec"
(projectile-with-default-dir (projectile-project-root)
(let ((command-prefix (rake--choose-command-prefix (projectile-project-root) (list :zeus "zeus test "
:bundler "bundle exec rspec "))))
(compile (concat command-prefix (coder/project-relative-current-file-path))))))
View calculator.fsx
open System
type Token =
| Number of int
| UnaryOperator of (int -> int -> int)
let tryCharToToken a =
match (Int32.TryParse a) with
| (true, num) -> Some (Number num)
| (false, _) ->
View transfer_huge_file.rb
# On the server side split the core file into 50M chunks naming them core.0000000000 etc.
# $ split -a 10 -b 50M -d core core.
# reassamble on the other side via
# $ cat core.* > core
chunk_count = 538
root_name = "core." # name on server is 'core.00001 etc'
host = ""
path = "/tmp"
View docker-machine-setup.el
(defun setup-docker-machine-env ()
" Parse the output of docker-machine env and setup the needed env vars"
(lambda (e)
(if e
(let ((var-value (split-string-and-unquote (car e) "=")))
(setenv (s-chop-suffix "=" (car var-value)) (car (cdr var-value))))))
(lambda (e)