I have a table with millions of rows that needs processing. The type of processing is not really important for this article. We simply need to process some data with Ruby --or any other user-space programming language.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! RenameFile() | |
let old_name = expand('%') | |
let new_name = input('New file name: ', expand('%')) | |
if new_name != '' && new_name != old_name | |
exec ':saveas ' . new_name | |
exec ':silent !rm ' . old_name | |
redraw! | |
endif | |
endfunction | |
map <leader>n :call RenameFile()<cr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NUMLINES=$(cat "$1" | | |
sed '{ | |
# Ignore the "References #blah" line | |
/^References \#[0-9]*/d | |
# Remove blank lines | |
/^$/d | |
# Remove lines containing only whitespace | |
/^[ \t]*$/d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'chef' | |
require 'chef/client' | |
require 'chef/run_context' | |
Chef::Config[:solo] = true | |
Chef::Config[:log_level] = :info | |
Chef::Log.level(:info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Current | |
$ ant build | |
Buildfile: /Users/andrewle/Projects/html5-boilerplate/build/build.xml | |
build: | |
[echo] Building a Production Environment... | |
-rev: | |
[echo] Increasing the build number... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Buildfile: /Users/andrewle/Projects/html5-boilerplate/build/build.xml | |
build: | |
[echo] Building a Production Environment... | |
-rev: | |
[echo] Increasing the build number... | |
[propertyfile] Updating property file: /Users/andrewle/Projects/html5-boilerplate/build/config/buildinfo.properties | |
[echo] Creating build 0009 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Lifted from http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim | |
" and cleaned up alignment for for easy reference. Posted here so I can find | |
" this easily. //Andrew Le | |
" Generated from c:/pdsrc/xterm-222/256colres.h by allcolors.pl | |
" Xterm can display text in 256 colors, but it is hard to determine what all | |
" those colors are. So below is a list of the approximate names for the 256 | |
" default colors in xterm. You can put it in your vimrc or just use it as a | |
" reference when in doubt. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<script> | |
function IsNewBrowser() | |
{ | |
var isIE = navigator.appName.indexOf("Microsoft") != -1; | |
var isNav = navigator.appName.search(/Netscape/i) != -1; | |
var ver = parseInt(navigator.appVersion); | |
if(isIE || (isNav && ver >=5) ) | |
return true ; | |
return false ; |
This is a list of things that I'm working on. All the projects that I want to spend more time doing that I work on depending on my mood the quality of time that I currently have.
Inspired by tips from Aaron Swartz at http://www.aaronsw.com/weblog/productivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
PROJECT_NAME = "" | |
pages = %w{ | |
... urls to pages go here | |
} | |
pages.each_with_index do |url, index| | |
system("python webkit2png.py -W 1200 -o #{PROJECT_NAME}_#{index} -F #{url}") |