Skip to content

Instantly share code, notes, and snippets.

@ushis
ushis / man-index.py
Created July 13, 2012 20:29
systemd man index
#!/usr/bin/env python3
from xml.etree import ElementTree as ETree
from glob import glob
PATH = './refsynopsisdiv/funcsynopsis/funcprototype/funcdef/function'
index = {}
for p in glob('systemd/man/*.xml'):
index[p] = [f.text for f in ETree.parse(p).findall(PATH)]
@ushis
ushis / tree.sh
Created March 31, 2012 22:56
tree... in bash
#!/bin/sh
_tree() {
IFS=$'\x0a'
local dir len i d
dir=($(ls "$1" --group-directories-first 2>/dev/null))
len=${#dir[@]}
for (( i = 0; i < len; i++ )); do
if (( i == len - 1 )); then
@ushis
ushis / usage.php
Created September 13, 2011 23:59
Basic usage of the output class
<?php
# Uses the default rules
echo Output::parse($input);
echo Output::factory($input)->get();
# Remove some rules
echo Output::factory($input)->remove_rules(array('em', 'strong'))->get();