Skip to content

Instantly share code, notes, and snippets.

@jgrodziski
jgrodziski / private.xml
Last active December 15, 2015 08:09
This is my modified private.xml that remap the 'shift' key to left and right paren respectively. Then 'cmd+shift' to [, 'alt-shift' to { (same for the right side). Very useful for all non-US keyboardist like me (french layout! definitely not one for hacker)
<?xml version="1.0"?>
<root>
<item>
<name>Use the correct shift keys.</name>
<identifier>private.correct_shift_keys</identifier>
<autogen>--KeyToKey-- KeyCode::Q, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen>
<autogen>--KeyToKey-- KeyCode::W, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen>
<autogen>--KeyToKey-- KeyCode::E, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen>
<autogen>--KeyToKey-- KeyCode::R, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen>
(defun nrepl-send-to-repl ()
"Send the appropriate forms to the repl to be evaluated."
(interactive)
(save-excursion
(cond
;; Region selected - evaluate region
((not (equal mark-active nil))
(copy-region-as-kill (mark) (point)))
;; At/before sexp - evaluate next sexp
((or (looking-at "\s(")
@jgrodziski
jgrodziski / zipper-core.clj
Created November 21, 2013 20:56
The source code of the Clojure User Group Paris talk about zipper data structure (nov 2013). Enjoy ! Slides are here : https://speakerdeck.com/jgrodziski/clojure-zipper
(ns zipper.core
(require [clojure.zip :as z]))
(def my-tree ["0" ["1A" "1B" "1C"
["2A" "2B" "2C"
["3A" "3B" "3C"]]
["2D" "2E" "2F"
["3D" "3E"]]
"1D" "1E" "1F"]])
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
@jgrodziski
jgrodziski / tunnelon.sh
Created December 3, 2013 15:31
open an ssh tunnel and automatically enable it on your Ethernet and Wifi connection
ssh -t -t -n -D 9999 YOUR_REMOTE_SERVER & >> /dev/null
sudo networksetup -setsocksfirewallproxy Ethernet localhost 9999
sudo networksetup -setsocksfirewallproxy Wi-Fi localhost 9999
sudo networksetup -setsocksfirewallproxystate Ethernet on
sudo networksetup -setsocksfirewallproxystate Wi-Fi on
@jgrodziski
jgrodziski / tunneloff.sh
Last active December 30, 2015 03:39
Disable the tunnel on wifi and ethernet
sudo networksetup -setsocksfirewallproxystate Ethernet off
sudo networksetup -setsocksfirewallproxystate Wi-Fi off
@jgrodziski
jgrodziski / config
Created December 24, 2013 10:43
My ssh config
ControlPersist yes
GSSAPIAuthentication no
Host *
Compression yes
CompressionLevel 7
Cipher blowfish
ServerAliveInterval 600
ControlMaster auto
ControlPath /tmp/ssh-%r@%h:%p
@jgrodziski
jgrodziski / custom-configuration.el
Created December 24, 2013 13:58
my emacs live custom configuration
(setq inferior-lisp-program "lein repl")
(require 'package)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(windmove-default-keybindings)
(defun nrepl-send-to-repl ()
"Send the appropriate forms to the repl to be evaluated."
@jgrodziski
jgrodziski / encrypt-folder
Created December 25, 2013 23:01
encrypt a folder to an image
echo -n "password" | hdiutil create -encryption -stdinpass -srcfolder GYB-GMail-Backup-jeremie@grodziski.com encrypted.dmg
@jgrodziski
jgrodziski / private.xml
Created November 22, 2013 12:13
This is my modified private.xml for keyremap4macbook and a US mac keyboard
<?xml version="1.0"?>
<root>
<appdef>
<appname>ITERM</appname>
<equal>com.googlecode.iterm2</equal>
</appdef>
<!--
KeyRemap4MacBook defines a list of apps to ignore when using any of the
"Emacs Mode" key mappings. That list includes "TERMINAL" (as well as other