Skip to content

Instantly share code, notes, and snippets.

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

Sylvain Benner syl20bnr

🎹
♬♩♪·♫ ​​​​​​​​​​♬♩♪ ♪·♫ ♬♩
  • Tracel Technologies
  • Quebec City, Canada
  • 08:04 (UTC -04:00)
View GitHub Profile
@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

@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]}'
@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)))
@syl20bnr
syl20bnr / i3_focus_win.py
Last active July 13, 2024 14:29
Python script for i3 which allows to focus the nth window of the current container hierarchy. It requires i3-py: https://github.com/ziberna/i3-py
#!/usr/bin/env python
#
# author: syl20bnr (2013)
# goal: Focus the nth window in the current workspace (limited to 10 firsts)
#
# Example of usage in i3 config:
#
# bindsym $mod+0 exec focus_win.py -n 0
# bindsym $mod+1 exec focus_win.py -n 1
# ... ...
# 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.")
@syl20bnr
syl20bnr / .pdbrc
Created October 8, 2014 17:39
Pretty print object in pdb
# Print a dictionary, sorted. %1 is the dict, %2 is the prefix for the names.
alias p_ for k in sorted(%1.keys()):print"%s%-15s= %-80.80s"%("%2",k,repr(%1[k]))
# Print the instance variables of a thing.
alias pi p_ %1.__dict__ %1.
# Print the instance variables of self.
alias ps pi self
# Print the locals.
alias pl p_ locals()local:
# Next and list, and step and list.
alias nl n;;l
(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-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 / .spacemacs.el
Last active January 22, 2019 20:56
Add cuda-mode in Spacemacs
(defun dotspacemacs/layers ()
"Configuration Layers declaration."
(setq-default
;; ...
;; List of additional packages that will be installed wihout being
;; wrapped in a layer. If you need some configuration for these
;; packages then consider to create a layer, you can also put the
;; configuration in `dotspacemacs/config'.
dotspacemacs-additional-packages '(cuda-mode)
;; ...