Skip to content

Instantly share code, notes, and snippets.

View Raimondi's full-sized avatar

Israel Chauca Fuentes Raimondi

View GitHub Profile
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@Raimondi
Raimondi / snippets.vim
Last active September 28, 2015 10:38
Vim snippets
" Count matches in a string.
function! s:count(str, pat)
let cnt = 1
let index = matchend(a:str, a:pat)
while index >= 0
let cnt += 1
let index = matchend(a:str, a:pat, index)
endwhile
return cnt - 1
endfunction
@daveray
daveray / seesaw-repl-tutorial.clj
Created December 7, 2011 04:55
Seesaw REPL Tutorial
; A REPL-based, annotated Seesaw tutorial
; Please visit https://github.com/daveray/seesaw for more info
;
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers
; Seesaw's basic features and philosophy, but only scratches the surface
; of what's available. It only assumes knowledge of Clojure. No Swing or
; Java experience is needed.
;
; This material was first presented in a talk at @CraftsmanGuild in
; Ann Arbor, MI.
@darcyparker
darcyparker / vimModeStateDiagram.svg
Last active July 15, 2025 05:22
Vim Modes Transition Diagram in SVG https://rawgithub.com/darcyparker/1886716/raw/eab57dfe784f016085251771d65a75a471ca22d4/vimModeStateDiagram.svg Note, most of the nodes in this graph have clickable hyperlinks to documentation.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Raimondi
Raimondi / seqbufnummaps.vim
Last active October 7, 2015 08:27
Define sequencial mappings for the first n listed buffers.
" SeqBufNumMaps([style[, limit]])
" Creates sequencial mappings to switch among listed buffers.
" It takes two optional arguments
" - lhs : The LHS of the mapping, use '%d' to place the number. e.g.:
" This will create mappings with weechat-style jumps '<Esc>j%d' (as
" suggested by ccxCZ), like <Esc>j1, >Esc>j2, etc.
" The default is '<leader>%d' => <leader>1, <leader>2, etc.
" The default value will be used if the argument is not provided, it
" is empty or it does not have the string '%d' inside.
" - limit: The maximum number of mappings to create. Default is 10.
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@danopia
danopia / .bashrc
Created August 31, 2012 07:55
Clippy at the Linux CLI
function command_not_found_handle {
{echo "It looks like you're trying to run a UNIX command.";echo "Would you like some help with that?"; echo; /usr/lib/command-not-found $1 2>&1|fold -sw 55}|cowsay -f$HOME/.clippy -n
}
me:
@true
a:
@true
sandwich:
@if test `whoami` != "root"; \
then \
echo "What? Make it yourself."; \
exit; \
else \
@inkarkat
inkarkat / SortUnfolded.vim
Created November 25, 2012 21:39
A sort function for Vim that keeps folded lines intact.
":[range]SortUnfolded[!] [i][u][r][n][x][o] [/{pattern}/]
" Sort visible lines in [range]. Lines inside closed folds
" are kept intact; sorting is done only on the first line
" of the fold; the other lines inside the fold move with
" it as a unit.
" Copyright: (C) 2012 Ingo Karkat
" The VIM LICENSE applies to this scriptlet; see ':help copyright'.
" Inspiration:
" http://stackoverflow.com/questions/13554191/sorting-vim-folds
function! s:ErrorMsg( text )
func! Inc(...)
if a:0
let g:inc = 0
else
let g:inc += 1
endif
return g:inc
endf
call Inc(1)
%s/regex/\=Inc()/