Skip to content

Instantly share code, notes, and snippets.

View costis's full-sized avatar
🎯
Focusing

Costis Panagiotopoulos costis

🎯
Focusing
View GitHub Profile
@costis
costis / integrated_docs.rb
Created November 21, 2012 13:14 — forked from mattwynne/integrated_docs.rb
Integrated documentation for Ruby
# For context, this was inspired by the RubyRogues podcast #79 where they talked about
# documentation in Ruby, and specifically grumbled quite a bit about the failings of RDoc.
#
# http://rubyrogues.com/079-rr-documenting-code/
#
# As someone who's spent a lot of time using an IDE for programming C# and Java, I think
# Ruby could do a lot better at putting documentation at our fingertips as we program.
#
# Maybe making the documentation part of the structure of the code would facilitate this?
#
@costis
costis / gist:4079034
Created November 15, 2012 14:58
RVM install ruby-perf (falcon patches)
rvm reinstall 1.9.3-perf --patch falcon --force-autoconf -j 3
@costis
costis / gist:4025267
Last active October 12, 2015 12:17
Send to Tmux from Vim
map <f9> :silent !tmux send-keys -t left 'ruby %' C-m<cr>
map <Leader>rl :silent !tmux send-keys -t right 'ruby %' C-m<cr>
# Clear screen and redrew Vim buffer.
map <Leader>aa :silent !tmux send-keys -t right 'clear; ruby %' C-m<CR>:redraw!<CR>
# Send current buffer to Ruby
nnoremap <leader>g :execute "!tmux send-keys -t bottom 'clear; ruby '" . expand('%:p') . "\r"<cr>
@costis
costis / gist:3885595
Created October 13, 2012 18:06
Search and replace in files
The other big option here is simply not to use vim:
sed -i 's/pattern/replacement/' <files>
or if you have some way of generating a list of files, perhaps something like this:
find . -name *.cpp | xargs sed -i 's/pattern/replacement/'
grep -rl 'pattern1' | xargs sed -i 's/pattern2/replacement/'
and so on!
@costis
costis / gist:3032221
Created July 2, 2012 09:16
Convert html, markdown etc to PDF
Use pandoc
@costis
costis / tmux-term-colors
Created June 4, 2012 11:39
Tmux and terminal colors
Don't set TERM in .bashrc
Start tmux with 'tmux -2' (this will enable 256 colors)
Use the following script to display color palette in terminal:
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done
@costis
costis / gist:2629139
Last active October 4, 2015 11:37
Checkinstall - Make debian packages
checkinstall -D --fstrans=0 make install
@costis
costis / gist:2558269
Created April 30, 2012 13:15
Rails console logging
http://rors.org/2011/07/17/inline-logging-in-rails-console.html
@costis
costis / benchmark.sh
Created March 8, 2012 15:32
Benchmarking linux servers
for i in cpu threads mutex memory; do
sysbench --test=$i run
done
@costis
costis / colors.sh
Created March 3, 2012 12:14
Print ANSI color table in a console
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done