Skip to content

Instantly share code, notes, and snippets.

droustchev / iterm 2 tmux auto-start
Last active Jul 31, 2018
List & attach to active tmux sessions, attach to new `default` session if no previous sessions exist
View iterm 2 tmux auto-start
tmux ls && read tmux_session && tmux attach -t ${tmux_session:-default} || tmux new -s ${tmux_session:-default}
droustchev /
Last active Apr 8, 2021
tmux vim navigation

I recently tried out the fantastic vim-tmux-navigator tmux plugin. Unfortunately, some the default key bindings conflict with some of the key bindings my fuzzy finder of choice uses. I wanted to remap them to the default vim split navigation commands that are prefixed with C-w, and found the solution of hjdivad in his gist. However, I wanted a simpler solution, so after some more digging I stumbled upon this reddit post and ultimately came up with the following solution, which doesn't rely on key bindings that unbind themselves, but uses tmux's 'key-tables'.


Keybase proof

I hereby claim:

  • I am droustchev on github.
  • I am droustchev ( on keybase.
  • I have a public key whose fingerprint is 3331 3910 BB89 4F2E 61BE 9521 E545 6303 EA1B 8E0F

To claim this, I am signing this object:

droustchev / date_dropdown.html
Created Apr 7, 2016
Moment Date Length Checker
View date_dropdown.html
<script src=""></script>
var langs = [
droustchev /
Last active Feb 20, 2017 — forked from kung-foo/gist:1730627
SQLAlchemy extension for "ON DUPLICATE KEY UPDATE"
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.sql.expression import Insert
def append_string(insert, compiler, **kw):
s = compiler.visit_insert(insert, **kw)
if 'append_string' in insert.kwargs:
return s + " " + insert.kwargs['append_string']
return s
droustchev / mongodb_dropCollection_helpers.js
Last active Aug 29, 2015
Small helper function that enables you to drop collections based on their name. Use with caution!
View mongodb_dropCollection_helpers.js
function dropCollections (colName) {
var collectionNames = db.getCollectionNames();
for (var i=0,len=collectionNames.length; i<len; i++) {
var collectionName = collectionNames[i];
if(collectionName.indexOf(colName) == 0) {
droustchev / mongodb_cloneCollection_helpers.js
Last active Aug 29, 2015
Small helper functions that enable you to easily clone collections that contain a date in the name (e.g. 'logs_2014-02-01') from one MongoDB instance to another.
View mongodb_cloneCollection_helpers.js
function getDateString (date) {
year = date.getFullYear();
month = ('0' + (date.getMonth()+1)).slice(-2);
day = ('0' + date.getDate()).slice(-2);
return year + "-" + month + "-" + day;
function dateIterator (colBaseName, startDate, dayCount) {
var date = startDate
var i = 0;
droustchev / autounattend_diskconfig.xml
Last active Dec 11, 2015
Autounattend.xml snippet for wiping and partitioning the disk.
View autounattend_diskconfig.xml