Skip to content

Instantly share code, notes, and snippets.

@vinodkd
vinodkd / term_title.sh
Last active December 14, 2015 17:39
setting the title of terminal tabs programatically, and setting them to the current directory
# add these to your .bash_profile
# title sets your terminal tab's title to any string you pass in.
# from http://stackoverflow.com/a/1687708
function title() { echo -n -e "\033]0;$@\007";}
# cd modifies the cd command and uses title to set it to whatever the current dir is.
# from http://superuser.com/a/296555
function cd() { builtin cd "$@" && title ${PWD##*/}; }
@vinodkd
vinodkd / import.rb
Last active December 17, 2015 11:19 — forked from ngauthier/import.rb
Since my posts had single and double quotes AND colons in the title, the original import.rb would fail when jekyll tried to read the yaml frontmatter. So instead of using an array and a string template, I changed the code to use a map and .to_yaml'd it. to_yaml produces the leading --- by default, so I appended the trailing one :)
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'yaml'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
doc = Nokogiri::XML(data)