return $_;
}
-$_ = qq{
-It was day.
-It was sunny.
-};
-
+#$_ = qq{
+#It was day.
+#It was sunny.
+#};
#die $_;
#open(SAY,"| espeak -v mb-en1+f5 -s 140 -m 2>/dev/null") or die $!;
}
html2txt() {
- lynx -pseudo_inlines -nomargins -display_charset=utf8 -nocolor -nolist -width=999 -dump $@
+ if which lynx > /dev/null; then
+ lynx -pseudo_inlines -nomargins -display_charset=utf8 -nocolor -nolist -width=999999 -dump "$1"
+ elif which w3m > /dev/null; then
+ w3m -dump -cols 999999 "$1"
+ else
+ echo "Please install lynx or w3m" 1>&2
+ return 1
+ fi
}
xml2csv() {
- xsltproc lib/xslt/csv.xslt $@
+ xsltproc lib/xslt/xml2csv.xslt $@
}
+++ /dev/null
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="text" encoding="utf-8" />
-
- <xsl:param name="break" select="'
'" />
- <xsl:param name="quote" select="''" />
- <xsl:param name="delim" select="'	'" />
-
- <xsl:template match="/">
- <xsl:apply-templates select="/*/*" />
- </xsl:template>
-
- <xsl:template match="/*/*">
- <xsl:apply-templates />
- <xsl:if test="following-sibling::*">
- <xsl:value-of select="$break" />
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="*">
- <!-- remove normalize-space() if you want keep white-space at it is -->
- <xsl:value-of select="concat($quote, normalize-space(), $quote)" />
- <xsl:if test="following-sibling::*">
- <xsl:value-of select="$delim" />
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="text()" />
-</xsl:stylesheet>
--- /dev/null
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text" encoding="utf-8" />
+
+ <xsl:param name="break" select="'
'" />
+ <xsl:param name="quote" select="''" />
+ <xsl:param name="delim" select="'	'" />
+
+ <xsl:template match="/">
+ <xsl:apply-templates select="/*/*" />
+ </xsl:template>
+
+ <xsl:template match="/*/*">
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::*">
+ <xsl:value-of select="$break" />
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="*">
+ <!-- remove normalize-space() if you want keep white-space at it is -->
+ <xsl:value-of select="concat($quote, normalize-space(), $quote)" />
+ <xsl:if test="following-sibling::*">
+ <xsl:value-of select="$delim" />
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="text()" />
+</xsl:stylesheet>
#!/usr/bin/env perl
use strict;
use warnings;
-@ARGV = ('w3m -dump -cols 10000 https://en.wikipedia.org/wiki/List_of_HTTP_status_codes |');
+@ARGV = ('bash --login -c "html2txt https://en.wikipedia.org/wiki/List_of_HTTP_status_codes" |');
while (<>) {
next unless /^\d\d\d / .. /^ /;
-#!/bin/sh
+#!/usr/bin/env bash
[ -n "$NB_ROOT" ] || . "$(dirname "$0")/../../etc/profile" || exit
-xsltproc $NB_ROOT/lib/xslt/csv.xslt http://www.user-agents.org/allagents.xml
+xml2csv http://www.user-agents.org/allagents.xml
--- /dev/null
+DROP TABLE IF EXISTS useragent;
+CREATE TABLE IF NOT EXISTS useragent (
+ id INT PRIMARY KEY,
+ string VARCHAR(500),
+ description VARCHAR(2000),
+ type VARCHAR(20),
+ comment VARCHAR(100),
+ link1 VARCHAR(1000),
+ link2 VARCHAR(1000)
+);
+
+BEGIN TRANSACTION;
+.separator \t
+.import "useragent.csv" useragent
+COMMIT;