Skip to content

Instantly share code, notes, and snippets.

@gx86
gx86 / gist:5619dee952e01e665822
Created October 16, 2014 02:23
rsync that I always forget
rsync -a -del --progress ...
#!/usr/bin/perl
=pod
tcpdump-colorize 1.0
Nicolas Martyanoff <khaelin@gmail.com>
This script is in the public domain.
=cut
use strict;
use warnings;

Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118

Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:

0 go to the beginning of this line. y yank from here (up to where?)

@gx86
gx86 / urls.txt
Last active August 29, 2015 14:01
vim plugin url list
https://github.com/altercation/vim-colors-solarized.git
https://github.com/SirVer/ultisnips.git
https://github.com/ddollar/nerdcommenter.git
https://github.com/tpope/vim-unimpaired.git
https://github.com/scrooloose/nerdtree.git
https://github.com/ervandew/supertab.git
https://github.com/scrooloose/syntastic.git
https://github.com/Lokaltog/vim-easymotion.git
https://github.com/chrisbra/NrrwRgn.git
https://github.com/tpope/vim-fugitive.git
@gx86
gx86 / .vimrc
Last active August 29, 2015 14:01
My Master .vimrc file
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" .vimrc - gx86's master vimrc "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" The master option ;P
set nocompatible
"""""""""""""
" GLOBALS "
"""""""""""""
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@gx86
gx86 / Random.sh
Created March 31, 2014 02:52
Random files bash
#one file, spaces handled correctly
files=(./*) printf "%s\n" "${files[RANDOM % ${#files[@]}]}"
#random list, spaces.. maybe
"$(ls | sort -R)"
@gx86
gx86 / ssh_fix.sh
Last active August 29, 2015 13:56
SSH Key Forward Fix for .bashrc
# http://qq.is/article/ssh-keys-through-screen
# Predictable SSH authentication socket location.
SOCK="/tmp/ssh-agent-$USER-screen"
if test $SSH_AUTH_SOCK && [ $SSH_AUTH_SOCK != $SOCK ]
then
rm -f /tmp/ssh-agent-$USER-screen
ln -sf $SSH_AUTH_SOCK $SOCK
export SSH_AUTH_SOCK=$SOCK
fi
@gx86
gx86 / post-receive.sample
Created February 6, 2014 05:52
post-receive hook to update site
#!/bin/bash
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "master" == "$branch" ]; then
GIT_WORK_TREE=PATH/TO/SITE checkout -f
fi
done