Skip to content

Instantly share code, notes, and snippets.

View syl20bnr's full-sized avatar
🎹
♬♩♪·♫ ​​​​​​​​​​♬♩♪ ♪·♫ ♬♩

Sylvain Benner syl20bnr

🎹
♬♩♪·♫ ​​​​​​​​​​♬♩♪ ♪·♫ ♬♩
  • Tracel AI
  • Quebec City, Canada
  • 23:58 (UTC -04:00)
View GitHub Profile
@syl20bnr
syl20bnr / evil-fd-trigger.el
Last active December 10, 2016 03:00
This function is for evil-mode Emacs users. It executes the passed callback when 'fd' sequence is quickly pressed.
;; inspired from:
;; https://github.com/roman/emacs.d/blob/master/zoo/zoo-evil.el
(evil-define-command fd-trigger (callback)
"Allows to execute the passed function using 'fd'."
:repeat change
(let ((modified (buffer-modified-p)))
(insert "f")
(let ((evt (read-event
(format "Insert %c to exit insert state" ?d)
nil 0.2)))
;;; spacemacs-mode-test.el --- Spacemacs Functional Test File
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Alberto Zaccagni & Contributors
;;
;; Author: Alberto Zaccagni <email>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
@syl20bnr
syl20bnr / init-popwin.el
Created May 4, 2013 03:44
popwin mode configuration working with helm.
(require 'popwin)
(setq display-buffer-function 'popwin:display-buffer)
(push '("^\*helm .+\*$" :regexp t) popwin:special-display-config)
(push '("^\*helm-.+\*$" :regexp t) popwin:special-display-config)
@syl20bnr
syl20bnr / build-emacs.sh
Created January 6, 2016 20:22 — forked from favadi/build-emacs.sh
Compile latest emacs version (24.5) in Ubuntu 14.04
#!/bin/bash
# Build latest version of Emacs, version management with stow
# OS: Ubuntu 14.04 LTS
# version: 24.5
# Toolkit: lucid
# Warning, use updated version of this script in: https://github.com/favadi/build-emacs
set -e
@syl20bnr
syl20bnr / make_list.sh
Created May 22, 2013 15:46
List rules of a Makefile.
#!/bin/sh
make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}'

For your Ruby, you'll must install this gems:

sudo gem install passenger

sudo passenger-install-apache2-module

At this moment, you'll asked to install some Apache2's deps (three deps):

sudo apt-get install apache2-prefork-dev

@syl20bnr
syl20bnr / emptyrm.sh
Created May 13, 2013 15:36
Remove all empty directories recursively.
while rmdir **/*(/N^F); do :; done
@syl20bnr
syl20bnr / ranger_autolaunch
Created April 26, 2013 15:01
Auto launch a ranger on top of every zsh session.
# Always launch a ranger session
if [[ $RANGER == "" ]]; then
export RANGER=1
ranger
fi
@syl20bnr
syl20bnr / evil-insert-line-no-state-change.el
Created April 18, 2013 21:05
This gist add functions to insert lines above and below the current line without changing the current evil state and current point position.
;; insert one or several line below without changing current evil state
(defun evil-insert-line-below (count)
"Insert one of several lines below the current point's line without changing
the current state and point position."
(interactive "p")
(save-excursion
(evil-save-state (evil-open-below count))))
;; insert one or several line above without changing current evil state
(defun evil-insert-line-above (count)
@syl20bnr
syl20bnr / mu4e-msgv-action-open-message.el
Created January 5, 2013 07:11
Open the message at point in the default external browser.
;; adapted from https://groups.google.com/d/topic/mu-discuss/ZXB72TR5GL0/discussion
(defun mu4e-msgv-action-view-in-browser (msg)
"View the body of the message in a web browser."
(interactive)
(let ((html (mu4e-msg-field (mu4e-message-at-point t) :body-html))
(tmpfile (format "%s/%d.html" temporary-file-directory (random))))
(unless html (error "No html part for this message"))
(with-temp-file tmpfile
(insert
"<html>"