Skip to content

Instantly share code, notes, and snippets.

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

Sylvain Benner syl20bnr

🎹
♬♩♪·♫ ​​​​​​​​​​♬♩♪ ♪·♫ ♬♩
  • Tracel AI
  • Quebec City, Canada
  • 06:47 (UTC -04:00)
View GitHub Profile
@syl20bnr
syl20bnr / benchmarks.json
Last active January 12, 2024 14:48
Burn backend comparison benchmark serialization example
{
"backend": "fusion<wgpu>",
"device": "BestAvailable",
"gitHash": "7a8bc990cc257c51d6a8dc449c13353f931e8081",
"max": 2844,
"mean": 2783,
"median": 2776,
"min": 2757,
"name": "matmul",
"numRepeats": 3,
@syl20bnr
syl20bnr / emacsaliases.sh
Created January 1, 2013 04:39
zsh aliases for emacs. It starts the emacs daemon if required.
export EDITOR='emacsclient -t -n -a ""'
alias ec='emacsclient -c -n -a ""'
alias et='emacsclient -t -a ""'
ecs() { emacsclient -c -n -a emacs "/sudo::$*" }
ets() { emacsclient -t -a emacs "/sudo::$*" }
@syl20bnr
syl20bnr / nodesktopsaveorsessionwarning.el
Created January 1, 2013 04:00
Remove annoying questions like “do you want to save desktop?” or “do you want to override last session file?”
;; Make emacs open all files in last emacs session.
;; Taken from ergoemacs, credits go to ergoemacs authors.
;; This functionality is provided by desktop-save-mode
;; (“feature” name: “desktop”).
;;
;; The mode is not on by default in emacs 23.1, and has a lot options.
;; The following is init settings for the mode for ErgoEmacs.
;; Goal: have emacs always auto open the set of opened files in last session,
;; even if emacs crashed in last session or the OS crashed in last session.
@syl20bnr
syl20bnr / evil-emacs-state-2-evil-normal-state.el
Last active April 29, 2020 10:00
evil-emacs-state is annoying, the following function and hook automatically switches back to evil-normal-state whenever the evil-emacs-state is entered. It allows a more consistent navigation experience among all mode maps. To enter special commands of custom mode maps, just enter the insert mode :-)
;; evil-emacs-state is annoying, the following function and hook automatically
;; switch back to evil-normal-state whenever the evil-emacs-state is entered.
;; It allows a more consistent navigation experience among all mode maps.
;; To enter special commands of custom mode maps, just enter the insert mode :-)
(defun evil-emacs-state-2-evil-normal-state ()
(evil-normal-state)
(remove-hook 'post-command-hook 'evil-emacs-state-2-evil-normal-state))
(add-hook 'evil-emacs-state-entry-hook
(lambda ()
(add-hook 'post-command-hook 'evil-emacs-state-2-evil-normal-state)))
@syl20bnr
syl20bnr / robocop.bat
Created December 12, 2012 16:23
robocopy exit codes suck :-)
rem -------------------------------------------------------------------------------
rem this file controls the error level returned by the tool robocopy in order to
rem be usable in a custom build step of Visual Studio
rem -------------------------------------------------------------------------------
robocopy.exe /A-:R /NP /NJH /NJS /NDL /NFL /NS /NC %*
rem if errorlevel 16 echo Robocopy Exit Status: ***FATAL ERROR*** & exit /b 1
rem if errorlevel 15 echo Robocopy Exit Status: FAIL MISM XTRA COPY & exit /b 1
rem if errorlevel 14 echo Robocopy Exit Status: FAIL MISM XTRA & exit /b 1
@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)
;; ...
@syl20bnr
syl20bnr / i3_focus_win.py
Last active November 19, 2018 10:45
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
# ... ...
Wed Apr 12 18:04:14 UTC 2017
@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
@syl20bnr
syl20bnr / pedantically_commented_playbook.yml
Created December 15, 2016 14:12 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.