 58b20109cf
			
		
	
	58b20109cf
	
	
	
		
			
			import sys
import yaml
with open(sys.argv[1]) as fp:
    data = fp.read()
if not data.find("---") == 0:
    # no head
    print("NO YAML HEAD FOUND")
    sys.exit(-1)
data = data[3:]
head_end = data.find("---")
head = data[0:head_end]
data = data[head_end+3:]
metadata = yaml.safe_load(head)
cats = metadata.pop('categories', None)
if cats != None:
    if type(cats) == list:
        tags = cats
    elif type(cats) == str:
        tags = cats.split()
    tags = list(map(lambda t: t.lower(), tags))
    metadata["tags"] = ", ".join(tags)
    new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}"
    # write it
    print(f"coverted: categories to tags: {tags} - {sys.argv[1]}")
    with open(sys.argv[1], "w") as fp:
        fp.write(new_data)
    sys.exit(0)
if not metadata.get("tags", None):
    metadata["tags"] = "untagged"
    new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}"
    print(f"untagged: {sys.argv[1]}")
    # write it
    with open(sys.argv[1], "w") as fp:
        fp.write(new_data)
    sys.exit(0)
print("No changes needed")
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | |
| comments: true
 | |
| date: 2015-03-28 00:28
 | |
| layout: post
 | |
| tags: computing, emacs, osx, terminal, zsh
 | |
| title: 'State of Terminal: 2015 Edition'
 | |
| ---
 | |
| I do this every year to keep track of the changes in my style. This is the first that goes public though
 | |
| 
 | |
| - I've moved to a __Macbook air 2013__ edition as my primary laptop (a work perk, thanks [\@plivo](https://twitter.com/plivo.com)).
 | |
| - __Emacs__ is the primary editor - I use [el-get](https://github.com/dimitri/el-get) to manage my emacs packages (my `init.el` is [hosted here](https://github.com/dbalan/.emacs.d/blob/master/init.el)), I also use [`mg`](http://homepage.boetes.org/software/mg/) heavily while I'm inside a terminal.
 | |
| - __iTerm2__ for terminal. (My [cheetsheet for for iterm is availabe here](https://gist.github.com/dbalan/378d2f3e4e6a27f0aae8))
 | |
| - __zsh__ for shell, with [antigen](https://github.com/zsh-users/antigen) managing plugins and dependencies.
 | |
| - __vagrant__ for VMs, I tried using `docker` with boot2docker, but my needs are diffrent. I just need a linux box that runs all the time.
 | |
| - [__Spectacle__](http://spectacleapp.com/) to manage windows. (Yes, I do miss Xmonad and i3)
 | |
| - __Firefox__ is the primary browser, sometimes __chromium__ running for some special sites and tasks.
 | |
| - __Todoist__ is a great app to track todo lists, and the concept of  gaming the task completion frequency and awarding points is a joy!
 | |
| - __Evernote__ everything goes inside this.
 | |
| - __KeePassX__ manages all my passwords.
 | |
| - __Tarsnap__ for backups, nuff said.
 | |
| 
 |