Skip to content

Instantly share code, notes, and snippets.

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

Sylvain Benner syl20bnr

🎹
♬♩♪·♫ ​​​​​​​​​​♬♩♪ ♪·♫ ♬♩
  • Tracel AI
  • Quebec City, Canada
  • 20:08 (UTC -04:00)
View GitHub Profile
# All of these examples are valid PEP-8
# Example #1
a = "a very long string with a lot of characters, more than the common 80 CPL limit."
# can be easily reformatted with parenthesis:
a = ("a very long string with a lot of characters, "
"more than the common 80 CPL limit.")
(defvar multiple-cursors-packages
'(
multiple-cursors
)
"List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")
(defvar multiple-cursors/init-multiple-cursors ()
(use-package multiple-cursors
:init

Spacemacs can be interfaced with different search utilities like:

The search commands in Spacemacs are organized under the SPC s prefix with the next key is the tool to use and the last key is the scope. For instance SPC s a b will search in all opened buffers using ag. If the last key (determining the scope) is uppercase then the current region

@syl20bnr
syl20bnr / replaceinfileslinux
Created December 10, 2012 14:12
Replace in files (linux)
# replace in all xml files
find . -name "*.xml" | xargs sed -i 's/reg_exp/replace/g'
@syl20bnr
syl20bnr / nosudo
Created December 11, 2012 19:40
No sudo
Defaults:nova !requiretty
Cmnd_Alias NOVACMDS = /bin/aoe-stat, \
/bin/chmod, \
/bin/chmod /var/lib/nova/tmp/*/root/.ssh, \
/bin/chown, \
/bin/chown /var/lib/nova/tmp/*/root/.ssh, \
/bin/dd, \
/bin/kill, \
/bin/mkdir, \
/bin/mount, \
@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>"
@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 / 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 / emptyrm.sh
Created May 13, 2013 15:36
Remove all empty directories recursively.
while rmdir **/*(/N^F); do :; done

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