Skip to content

Instantly share code, notes, and snippets.

@ttscoff
ttscoff / sizes.rb
Last active July 12, 2021 03:33
sizes: Calculate and sort all filesizes for current folder
#!/usr/bin/env ruby
# Sizes - Calculate and sort all filesizes for current folder Includes
# directory sizes, colorized output Brett Terpstra 2019 WTF License
VERSION = "1.0.1"
require 'shellwords'
# Just including term-ansicolor by @flori and avoiding all the
# rigamarole of requiring multiple files when it's not a gem... - Brett
#
@dirkk
dirkk / xquery_vim
Created November 21, 2012 10:17
How to do nice XQuery coding in vim
1. Install Exuberant Ctags
2. Create ~/.ctags with the following content to (rudimentary) support XQuery for ctags:
--langdef=xquery
--langmap=xquery:.xq.xqm.xqy
--regex-xquery=/^[ \t]*declare?[ \t]*(%[^%])*[ \t]*function[ \n\t]*([_a-zA-Z0-9:-]*:)?([_a-zA-Z0-9-]+)/\3/f,function/
--regex-xquery=/^[ \t]*declare[ \t]*variable[ \t]*\$([_a-zA-Z0-9:-]*:)?([_a-zA-Z0-9-]+)/\2/v,variable/
--regex-xquery=/^module namespace[ \t]*(\w+)[ \t]*=.*/\1/m,module/
3. Install the Tlist vim plugin: vim-taglist.sourceforge.net
@ttscoff
ttscoff / planter.rb
Created September 22, 2012 17:57
Create directory trees from indented text input
#!/usr/bin/ruby
=begin
Planter v1.3
Brett Terpstra 2013
ruby script to create a directory structure from indented data.
Three ways to use it:
- Pipe indented (tabs or 2 spaces) text to the script
- e.g. `cat "mytemplate" | planter.rb
- Create template.tpl files in ~/.planter and call them by their base name