initial commit

This commit is contained in:
Quentin W 2024-07-18 14:09:32 -04:00
commit 5b839e0543
174 changed files with 12261 additions and 0 deletions

174
werc/apps/barf/bin/bsrc Executable file
View file

@ -0,0 +1,174 @@
#!/bin/rc
# Build static pages for $site.
rfork e
fn usage{
echo usage: $0 [ domain.com ] >[1=2]
exit usage
}
if(~ $#1 0)
usage
fn conf_enable_barf{ }
werc=/var/www/werc
site=$werc/sites/$1
barf_root=$site
. $site/_werc/config
. $site/_werc/barf/config
. $werc/apps/barf/lib/core
. $werc/apps/barf/lib/$barf_type
if(test -f $site/_werc/barf/lib/$barf_type)
. $site/_werc/barf/lib/$barf_type
if(~ $show_ascending 1)
sort=(sort -nu)
if not
sort=(sort -nru)
fn check_user{ }
fn display_html_footers{
echo '</body>
</html>'
}
fn display_html_headers{
echo '<html>
<head>
<title>'$"siteTitle'</title>
<link rel="stylesheet" href="/_werc/pub/style.css" type="text/css" media="screen" title="default">
<link rel="shortcut icon" href="/favicon.ico" type="image/vnd.microsoft.icon">
<link rel="alternate" type="application/rss+xml" title="RSS" href="'$"rss'">
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
'
}
fn display_prevnext{
if(~ $#nstart 1){
echo '
<div id="page_list">
<span>
'
if(test $start -lt $pstop && ! ~ $start $pstart)
echo '<a href="'$pstart^'-'^$pstop^'.html">prev</a> | '
echo '</span>
<span>
'
if(test $nstart -gt $bposts($#bposts))
echo '<a href="'$nstart^'-'^$nstop^'.html">next</a>'
echo '
</span>
</div>
'
}
}
fn get_post_list{
if(~ $#posts 0){
if(~ $id [0-9]*)
posts=$id
if not{
posts=`{
if(~ $tags all)
ls -p $site/src |
grep -e '^[0-9]*$' |
eval $sort |
sed -n $start^,^$stop^p
if not
grep -e '^.*\/'$tags'$' $site/tags |
awk -F '/' '{print $1;}' |
eval $sort |
sed -n $start^,^$stop^p
}
if(! ~ $posts [0-9]*)
posts=()
}
}
}
fn print{
display_html_headers
if(~ $show_header 1)
display_header
display_^$barf_type
if(~ $show_sidebar 1)
display_sidebar
if(~ $show_footer 1)
display_footer
display_html_footers
}
fn print_id{
echo '<span id="post_id"><a href="'$"a_id'.html">No.'$"a_id'</a></span>'
}
fn print_tags{
a_tags=`{ls -p $a_dir/tags}
a_tags=`{for(t in $a_tags) echo '<a href="/tag/'$t'">'$t'</a>, '}
a_tags=`{echo $a_tags | awk '{print substr($0, 1, length($0) -1)}'}
echo '<span id="post_tags">'$"a_tags'</span>'
}
fn print_title{
a_title=`{cat $a_dir/title}
if(! ~ $#a_title 0){
if(~ $barf_type log url)
echo '<a href="'`{cat $a_dir/link}'">'$"a_title'</a>'
if not
echo '<a href="'$"a_id'.html">'$"a_title'</a>'
}
}
cd $site
# individual posts
bposts=`{ls -p $site/src | grep -v private | grep -e '^[0-9]*$' | eval $sort}
for(b in $bposts){
id=$b posts=() print >$b.html
echo $"b^'.html' >[1=2]
}
# paginated posts
start=$bposts(1)
stop=`{echo $bposts(1)^-^$posts_per_page | bc}
pstart=$start
pstop=$stop
while(test $start -ge $bposts($#bposts)){
if(test $stop -lt $bposts($#bposts))
stop=$bposts($#bposts)
nstart=`{echo $stop^-^1 | bc}
nstop=`{echo $stop^-^$posts_per_page^-1 | bc}
pposts=`{
for(i in `{seq $stop $start | eval $sort})
if(test -d $site/src/$i)
echo $i
}
tags=all posts=$pposts print >$start^-^$stop.html
echo $"start^'-'^$"stop^'.html' >[1=2]
pstart=$start
pstop=$stop
start=`{echo $stop^-1 | bc}
stop=`{echo $start^-^$posts_per_page | bc}
}
cp `{ls [0-9]*-[0-9]*.html | sort -n | tail -1} index.html
if(test -x /boot/factotum)
chmod +t [0-9]*.html [0-9]*-[0-9]*.html index.html
# tags
for(b in `{awk -F '/' '{print $3;}' tags | sort -u}){
btags=$b
mkdir -p tag/$btags
bposts=`{grep -e '^.*\/'$btags'$' tags | awk -F '/' '{print $1;}' | eval $sort}
start=$bposts(1)
stop=$bposts($#bposts)
tags=all posts=$bposts print >tag/$btags/index.html
echo tag/$btags/index.html >[1=2]
if(test -x /boot/factotum)
chmod +t tag tag/$btags tag/$btags/index.html
}

31
werc/apps/barf/bin/dsrc Executable file
View file

@ -0,0 +1,31 @@
#!/bin/rc
# 2016-05-01T18:47:42-0400
# Delete posts $low through $high.
rfork e
dhost=ur.inri.net
fn usage {
echo usage: dsrc [ -r n ] [ -t n ] >[1=2]
exit usage
}
switch($1){
case -r
site=/usr/sl/www/werc/sites/read.stanleylieber.com
case -t
site=/usr/sl/www/werc/sites/tumblr.stanleylieber.com
case *
usage
}
if(! ~ $sysname ur){
rcpu -h $dhost -c dsrc $*
exit
}
low=`{ls -p $site/src | sort -n | sed 1q}
high=$2
cd $site/src && rm -rf `{seq $low $high}
{
for(i in `{seq $low $high})
echo ',x/^'$i'\/.*\n/d'
echo w
echo w
echo q
} | sam -d $site/tags >[2]/dev/null

426
werc/apps/barf/bin/gf Executable file
View file

@ -0,0 +1,426 @@
#!/bin/rc
# Parse RSS feeds from livejournal or tumblr into BARF blog posts
# for the specified site. If a post with a matching <link> already
# exists, no new post will be created for that <item>. Accordingly,
# the gf script may run slowly for sites with a large number of
# existing posts. Tags will be created from each <category>.
rfork en
switch($1){
case 1oct1993_lj
feed=http://feeds.feedburner.com/Sl/1oct1993
site=1oct1993.com
tags=(rss)
case architecture
feed='http://pipes.yahoo.com/pipes/pipe.run?_id=6e361b590b57934fb1e7c4e29339d619&_render=rss'
site=read.stanleylieber.com
tags=(architecture)
case comics
feed='http://pipes.yahoo.com/pipes/pipe.run?_id=6bc617a6b20aafd526affafc9a28a5d5&_render=rss'
site=read.stanleylieber.com
tags=(comics)
case fg_lj
feed=http://feeds.feedburner.com/Sl/flamesgif
site=flamesgif.com
tags=(rss livejournal)
case inri_lj
feed=http://feeds.feedburner.com/Sl/itrecords
site=inri.net
tags=(rss livejournal)
case mf_lj
feed=http://feeds.feedburner.com/Sl/massivefictions
site=massivefictions.com
tags=(rss livejournal)
case other_lj
feed=http://feeds.feedburner.com/SL/other
site=other.stanleylieber.com
tags=()
case read
#feed=http://feeds.feedburner.com/SL/g/friends
#feed='http://pipes.yahoo.com/pipes/pipe.run?_id=f5d60acfd41497310d74900270192600&_render=rss'
feed='http://pipes.yahoo.com/pipes/pipe.run?_id=d1f7146306b019d96d768facf95eebd9&_render=rss'
site=test.stanleylieber.com
tags=()
case sl_lj
feed=http://feeds.feedburner.com/ImNotReallyStanleyLieber
site=stanleylieber.com
tags=(rss livejournal)
case sl_tumblr
feed=http://stanleylieber.tumblr.com/rss
site=stanleylieber.com
tags=(rss tumblr)
case ta_lj
feed=http://feeds.feedburner.com/Sl/text_adventure
site=textadventure.stanleylieber.com
tags=(rss livejournal)
case tech
feed='http://pipes.yahoo.com/pipes/pipe.run?_id=6dd49be6e34a6871db9bcfc74d4b36b1&_render=rss'
site=read.stanleylieber.com
tags=(tech)
case *
echo 'Usage: gf [ ... ]' >[1=2]
exit usage
}
file=/tmp/gf.$1
werc=/usr/sl/www/werc
if(test -f /boot/factotum)
cmd=hget
if not
cmd='curl -s'
fn get_feed{
$"cmd $feed >$file.work
{
echo '
,s/ //g
,s/\&quot;/\"/g
,s/\&#34;/\"/g
,s/\&amp;/\&/g
,s/\&#38;/\&/g
,s/\&#39;/''/g
,s/\&#44;/,/g
,s/\&#45;/-/g
,s/\&#46;/\./g
,s/\&#47;/\//g
,s/\&#58;/:/g
,s/\&#59;/;/g
,s/\&lt;/</g
,s/\&#60;/</g
,s/\&#61;/=/g
,s/\&gt;/>/g
,s/\&#62;/>/g
,s/\&#95;/_/g
,s/\|/\&#124;/g
,s/\n//g
,s/<\/item>/\n<\/item>\n/g
,s/^<item>/<item>\n/g
,s/^[ ]*<guid/<guid/g
,s/^<[\/i].*$//g
,s/^[ ]*\n[ ]*$//g
x/<description>.*<\/description>/ s/\n//g
w
q
'
echo
} | sam -d $file.work >[2]/dev/null >[1=2]
awk '/(^<item>|<guid|<link>|<pubDate>|<title>|<description>|<comments>|<category>|<\/item>)/ {print $0;}' $file.work >$file
}
fn get_tags{
switch($a_link){
case *1oct1993*
tags=($tags 1oct1993)
case *9front*
tags=($tags software plan9 9front)
case *amyearles* *pushedunder* *seaglass* *woolandwater*
tags=($tags amy_earles)
case *animenewsnetwork*
tags=($tags telescreen anime)
case *spikejapan*
tags=($tags japan comics manga telescreen anime)
case *ArchDaily* *archdaily*
tags=($tags archdaily architecture)
case *bldgblog*
tags=($tags bldgblog architecture)
case *kazuyosejima*
tags=($tags japan architecture)
case *Minimalissimo*
tags=($tags minimalissimo design architecture)
case *ArtFagCity* *artfagcity*
tags=($tags artfagcity art)
case *rhizome-fp*
tags=($tags rhizome-fp art)
case *rhizome*
tags=($tags rhizome art)
case *starwarsmodern*
tags=($tags starwarsmodern art)
case *tokyoartbeat*
tags=($tags tokyoartbeat japan art)
case *trendbeheer*
tags=($tags trendbeheer art)
case *ValentinaTanni*
tags=($tags valentinatanni art)
case *vvork*
tags=($tags vwork art)
case *auriea* *tale-of-tales* *taleoftales*
tags=($tags auriea)
case *basscomm* *closeoutwarrior* *crummysocks* *gamerrelocationproject* *protipoftheday* *PushButtonB* *pushbuttonb*
tags=($tags video_games basscomm)
case *benjaminmarra*
tags=($tags comics benjamin_marra)
case *boingboing*
tags=($tags boingboing)
case *bushinbooks* *henka*
tags=($tags budo)
case *alexaanddave* *CEREBUS* *Cerebus* *cerebus* *davesim* *gerhard*
tags=($tags comics cerebus gerhard)
case *coilhouse*
tags=($tags coilhouse)
case *arche-arc*
tags=($tags arche comics)
case *blaiselarmee*
tags=($tags blaise_larmee comics)
case *bleedingcool*
tags=($tags bleedingcool comics)
case *bobgreenberger*
tags=($tags bob_greengerger comics)
case *coldheatcomics*
tags=($tags coldheat comics)
case *comicbookresources*
tags=($tags cbr comics)
case *comicsbeat*
tags=($tags comicsbeat comics)
case *ComicsComics* *comicscomics*
tags=($tags comicscomics comics)
case *coveredblog*
tags=($tags coveredblog comics)
case *dcfifty-too*
tags=($tags dcfifty-too comics)
case *Destructoid* *destructoid*
tags=($tags destructoid video_games)
case *economist.com*
tags=($tags economist)
case *ferrandelgado*
tags=($tags ferran_delgado comics)
case *eddiecampbell*
tags=($tags eddie_campbell comics)
case *factualopinion*
tags=($tags factualopinion comics)
case *floating_world* *floatingworld*
tags=($tags floating_world comics)
case *frankmiller*
tags=($tags frank_miller comics)
case *humancolor*
tags=($tags humancolor comics)
case *jerkcity*
tags=($tags jerkcity comics)
case *newconstructionblog*
tags=($tags newconstruction manga comics)
case *ohdannyboy*
tags=($tags ohdannyboy comics)
case *pulphope*
tags=($tags pulphope comics)
case *pwbeat*
tags=($tags pwbeat comics)
case *reliablecomics*
tags=($tags reliablecomics comics)
case *reneefrench*
tags=($tags renee_french comics)
case *rickveitch*
tags=($tags rick_veitch comics)
case *smbc-comics*
tags=($tags smbc comics)
case *studygroup*
tags=($tags studygroup comics)
case *xkcd*
tags=($tags xkcd comics)
case *bowiesongs* *DavidBowie* *davidbowie*
tags=($tags music david_bowie)
case *designboom*
tags=($tags designboom design)
case *dezeen*
tags=($tags dezeen design)
case *infosthetics*
tags=($tags infosthetics design)
case *inhabitat*
tags=($tags inhabitat architecture design)
case *luigicolani*
tags=($tags luigicolani design)
case *mocoloco*
tags=($tags mocoloco design)
case *sydmead*
tags=($tags sydmead design)
case *dzima*
tags=($tags dzima)
case *bbcicecream*
tags=($tags bbcicecream fashion)
case *DamStyle *damstyle*
tags=($tags damstyle fashion)
case *facehunter*
tags=($tags facehunter fashion)
case *StilInBerlin*
tags=($tags germany fashion)
case *jstreets*
tags=($tags jstreets japan fashion)
case *stylefromtokyo*
tags=($tags stylefromtokyo japan fashion)
case *tokyofashion*
tags=($tags tokyofashion japan fashion)
case *flames.gif* *flamesgif*
tags=($tags flames.gif)
case *contemporary-home-computing*
tags=($tags software flames.gif)
case *kurzweil*
tags=($tags kurzweil future)
case *longnow*
tags=($tags longnow future)
case *OpenTheFuture*
tags=($tags openthefuture future)
case *golang* *blog.nella.org*
tags=($tags golang)
case *googlepluses*
tags=($tags google)
case *news.ycombinator.com*
tags=($tags hackernews hack)
case *seanbonner*
tags=($tags sean_bonner hack)
case *banriman*
tags=($tags banriman japan)
case *japansubculture*
tags=($tags japansubculture japan)
case *jeansnow*
tags=($tags jeansnow japan)
case *Kotaku* *kotaku*
tags=($tags kotaku video_games)
case *eforemario*
tags=($tags before_mario video_games)
case *nakakobooks*
tags=($tags books nakakobooks japan)
case *ozawamaria*
tags=($tags maria_ozawa japan)
case *shisaku.blogspot.com*
tags=($tags shisaku japan)
case *jimshooter*
tags=($tags comics jim_shooter)
case *LettersOfNote* *lettersofnote*
tags=($tags letters)
case *nasa*letters.rss*
tags=($tags nasa letters)
case *hellodamage* *manganews* *naokiurasawa* *samehat*
tags=($tags comics manga)
case *mangatraders*
tags=($tags p2p comics manga)
case *hortonheardawho*
tags=($tags hortonheardawho flickr nasa mars)
case *me-vs-gutenberg* *mevsgutenberg*
tags=($tags martin_sand)
case *marxy*
tags=($tags marxy)
case *etamodern*
tags=($tags metamodern)
case *aviationintel*
tags=($tags aviationintel mil)
case *aviationweek*
tags=($tags aviationweek mil)
case *codeonemagazine*
tags=($tags codeonemagazine mil)
case *geimint*
tags=($tags geimint mil)
case *momus* *mrstsk*
tags=($tags books music momus)
case *bjork* *toog*
tags=($tags music)
case *nasa.gov*
tags=($tags space nasa)
case *mongoliad*
tags=($tags neal_stephenson)
case *gaiman*
tags=($tags comics neil_gaiman)
case *nin.com* *feeds.nin.com*
tags=($tags music nin)
case *nix-os* *syssoftware*
tags=($tags plan9 nix)
case *bsdly* *OPENBSD* *OpenBSD* *openbsd* *scientist-home* *undeadly*
tags=($tags software openbsd)
case *godownmatthew* *mysticmilk* *petetoms*
tags=($tags pete_toms)
case *Pitchfork* *pitchfork*
tags=($tags music pitchfork)
case *9gridchan* *cat-v* *maht0x0r* *Plan9* *plan9*
tags=($tags software plan9)
case *FlauntTalks* *prince.org* *purpleinterviews* *wendyandlisa*
tags=($tags music prince)
case *commandcenter* *rob_pike*
tags=($tags golang plan9 rob_pike)
case *prometheus*
tags=($tags telescreen prometheus)
case *reddit.com*
tags=($tags reddit)
case *swtch.com*
tags=($tags golang plan9 rsc)
case *bunniestudios*
tags=($tags bunniestudios security)
case *jwz*
tags=($tags jwz security)
case *Krebs* *krebs*
tags=($tags krebs security)
case *scarybeastsecurity*
tags=($tags scarybeast security)
case *schneier*
tags=($tags bruce_schneier security)
case *chinchillakwak* *skwak*
tags=($tags skwak)
case *slashdot*
tags=($tags slashdot)
case *stanleylieber*
tags=($tags stanleylieber)
case *fastcompany*
tags=($tags fastcompany tech)
case *danharmon*
tags=($tags danharmon telescreen)
case *mindlessones*
tags=($tags mindlessones telescreen)
case *tcj.com*
tags=($tags comics tcj)
case *TEDblog* *ted.com*
tags=($tags ted)
case *ticom*
tags=($tags ticom security)
case *orrentfreak*
tags=($tags p2p torrentfreak)
case *ultra*culture*
tags=($tags ultraculture)
case *kleinletters*
tags=($tags comics todd_klein)
case *plaidstallions*
tags=($tags plaidstallions toys)
case *shojikawamori*
tags=($tags shojikawamori japan toys)
}
echo -n $tags
}
fn parse_posts{
ifs='
' {
posts=`{cat $file}
for(i in `{seq 1 $#posts | sort -nr}){
post=`{echo $posts($i) | sed 's/> </>\n</g' | grep -v -e '<comments>'}
if(! ~ $post ''){
a_title=`{echo $post | grep -e 'title>' | sed 's/^.*<title>//g; s/<\/title>.*$//g'}
a_date=`{echo $post | grep -e '<pubDate>' | sed 's/^.*<pubDate>//g; s/<\/pubDate>.*$//g'}
a_link=`{echo $post | grep -e '<link>' | sed 's/^.*<link>//g; s/<\/link>.*$//g; s/^.*http/http/g'}
a_tags=`{echo $post | grep -e '<category>' | sed 's/^.*<\/comments>//g; s/^.*<description>//g; s/^.*<\/description>//g; s/^.*<\/pubDate>//g; s/<category>/ /g; s/<\/category>//g; s/<dc.*$//g; s/^ //g; s/ $//g'}
a_tags=`{for(j in $a_tags){ echo $j | sed 's/^.*(<|>).*$//g'}}
a_body=`{echo $post | grep -e '<description>' | sed 's/^.*<description>//g; s/<\/description>.*$//g'}
a_id=`{echo `{ls -p $werc/sites/$site/src | sort -n | tail -1}^+1 | bc}
if(~ $#a_id 0)
a_id=1
while(test -d $werc/sites/$site/src/$a_id)
a_id=`{echo $a_id^+1 | bc}
if(! ~ $"a_link '' && ! ~ $"a_link `{cat $werc/sites/$site/src/*/link}){
mkdir -p $werc/sites/$site/src/$a_id/tags # big fat race
echo $"a_title >$werc/sites/$site/src/$a_id/title
echo $"a_date >$werc/sites/$site/src/$a_id/date
echo $"a_link >$werc/sites/$site/src/$a_id/link
echo $"a_body '</a></li></ul>' >$werc/sites/$site/src/$a_id/body
ifs=' ' {
for(j in `{get_tags}){
>$werc/sites/$site/src/$a_id/tags/$j
echo $a_id/tags/$j >>$werc/sites/$site/tags
}
}
}
if(test -f /boot/factotum && ~ $site *.stanleylieber.com)
for(i in `{f $werc/sites/$site/src/$a_id})
chmod +t $i
}
}
}
}
if(test -f /boot/factotum && test -f /rc/bin/hget)
webfs
get_feed
parse_posts

20
werc/apps/barf/bin/gk Executable file
View file

@ -0,0 +1,20 @@
#!/bin/rc
# Create an index of known_tags in $werc/sites/$site/known_tags
if(! ~ $#1 0)
base=$1
if not if(~ $#barf_root 1 && $#barf_base 1)
base=$barf_root/$"barf_base
if not
base=`{pwd}
if(test -f $base/_known_tags)
rm $base/_known_tags
for(i in `{cat $base/etc/tags}){
grep -e '^.*\/'$i'$' $base/tags |
awk -F '/' '{print $3;}' |
sort |
uniq -c |
awk '{print $2 " " $1;}' >>$base/_known_tags
}
if(test -f $base/_known_tags)
cp $base/_known_tags $base/known_tags

415
werc/apps/barf/bin/gr Executable file
View file

@ -0,0 +1,415 @@
#!/bin/rc
# Parse RSS feeds from Google Reader bundles into BULGE blog posts.
# If a post with a matching <link> already exists, no new post will
# be created for that <item>. Accordingly, the gr script may run
# slowly for sites with a large number of existing posts. Tags will
# be created from each <category>.
rfork en
switch($1){
case architecture
feed='http://pipes.yahoo.com/pipes/pipe.run?_id=6e361b590b57934fb1e7c4e29339d619&_render=rss'
site=read.stanleylieber.com
tags=(architecture)
case comics
feed='http://pipes.yahoo.com/pipes/pipe.run?_id=6bc617a6b20aafd526affafc9a28a5d5&_render=rss'
site=read.stanleylieber.com
tags=(comics)
case friends
feed='https://www.google.com/reader/bundle/user%2F08193524211692385241%2Fbundle%2Ffriends'
site=read.stanleylieber.com
tags=(friends)
case tech
feed='http://pipes.yahoo.com/pipes/pipe.run?_id=6dd49be6e34a6871db9bcfc74d4b36b1&_render=rss'
site=read.stanleylieber.com
tags=(tech)
case *
echo usage: `{basename $0} '[ ... ]' >[1=2]
exit usage
}
file=/tmp/gr.$1
werc=/usr/sl/www/werc
if(test -f /boot/factotum)
cmd=hget
if not
cmd='curl -s'
fn f{ du -a $* | sed 's/^.* //g' }
fn get_feed{
$"cmd $feed >$file.work
{
echo '
,s/\&quot;/\"/g
,s/\&#34;/\"/g
,s/\&amp;/\&/g
,s/\&#38;/\&/g
,s/\&#39;/\''/g
,s/\&#44;/,/g
,s/\&#45;/-/g
,s/\&#46;/\./g
,s/\&#47;/\//g
,s/\&#58;/:/g
,s/\&#59;/;/g
,s/\&lt;/</g
,s/\&#60;/</g
,s/\&#61;/=/g
,s/\&gt;/>/g
,s/\&#62;/>/g
,s/\&#95;/_/g
,s/\|/\&#124;/g
,/<div id="items">/d
/<div id="sidebar">/,d
,s/<h2 class="item-title">/\n<h2 class="item-title">/g
,s/<div class="item">.*$/HJDIVIDER/g
,s/\n//g
,s/HJDIVIDER/\n/g
1d
w
q
'
echo
} | sam -d $file.work >[2]/dev/null >[1=2]
}
fn get_tags{
switch($a_link){
case *1oct1993*
tags=($tags 1oct1993)
case *9front*
tags=($tags software plan9 9front)
case *amyearles* *pushedunder* *seaglass* *woolandwater*
tags=($tags amy_earles)
case *animenewsnetwork*
tags=($tags telescreen anime)
case *spikejapan*
tags=($tags japan comics manga telescreen anime)
case *ArchDaily* *archdaily*
tags=($tags archdaily architecture)
case *bldgblog*
tags=($tags bldgblog architecture)
case *kazuyosejima*
tags=($tags japan architecture)
case *Minimalissimo*
tags=($tags minimalissimo design architecture)
case *ArtFCity* *ArtFagCity* *artfagcity*
tags=($tags artfagcity art)
case *rhizome-fp*
tags=($tags rhizome-fp art)
case *rhizome*
tags=($tags rhizome art)
case *starwarsmodern*
tags=($tags starwarsmodern art)
case *tokyoartbeat*
tags=($tags tokyoartbeat japan art)
case *trendbeheer*
tags=($tags trendbeheer art)
case *ValentinaTanni*
tags=($tags valentinatanni art)
case *vvork*
tags=($tags vwork art)
case *auriea* *tale-of-tales* *taleoftales*
tags=($tags auriea)
case *basscomm* *closeoutwarrior* *crummysocks* *gamerrelocationproject* *protipoftheday* *PushButtonB* *pushbuttonb*
tags=($tags video_games basscomm)
case *benjaminmarra*
tags=($tags comics benjamin_marra)
case *boingboing*
tags=($tags boingboing)
case *bushinbooks* *henka*
tags=($tags budo)
case *alexaanddave* *CEREBUS* *Cerebus* *cerebus* *davesim* *gerhard*
tags=($tags comics cerebus gerhard)
case *coilhouse*
tags=($tags coilhouse)
case *arche-arc*
tags=($tags arche comics)
case *blaiselarmee*
tags=($tags blaise_larmee comics)
case *bleedingcool*
tags=($tags bleedingcool comics)
case *bobgreenberger*
tags=($tags bob_greengerger comics)
case *coldheatcomics*
tags=($tags coldheat comics)
case *comicbookresources*
tags=($tags cbr comics)
case *comicsbeat*
tags=($tags comicsbeat comics)
case *ComicsComics* *comicscomics*
tags=($tags comicscomics comics)
case *coveredblog*
tags=($tags coveredblog comics)
case *dcfifty-too*
tags=($tags dcfifty-too comics)
case *Destructoid* *destructoid*
tags=($tags destructoid video_games)
case *economist.com*
tags=($tags economist)
case *ferrandelgado*
tags=($tags ferran_delgado comics)
case *eddiecampbell*
tags=($tags eddie_campbell comics)
case *factualopinion*
tags=($tags factualopinion comics)
case *floating_world* *floatingworld*
tags=($tags floating_world comics)
case *frankmiller*
tags=($tags frank_miller comics)
case *humancolor*
tags=($tags humancolor comics)
case *jerkcity*
tags=($tags jerkcity comics)
case *newconstructionblog*
tags=($tags newconstruction manga comics)
case *ohdannyboy*
tags=($tags ohdannyboy comics)
case *pulphope*
tags=($tags pulphope comics)
case *pwbeat*
tags=($tags pwbeat comics)
case *reliablecomics*
tags=($tags reliablecomics comics)
case *reneefrench*
tags=($tags renee_french comics)
case *rickveitch*
tags=($tags rick_veitch comics)
case *smbc-comics*
tags=($tags smbc comics)
case *studygroup*
tags=($tags studygroup comics)
case *xkcd*
tags=($tags xkcd comics)
case *bowiesongs* *DavidBowie* *davidbowie*
tags=($tags music david_bowie)
case *designboom*
tags=($tags designboom design)
case *dezeen*
tags=($tags dezeen design)
case *infosthetics*
tags=($tags infosthetics design)
case *inhabitat*
tags=($tags inhabitat architecture design)
case *luigicolani*
tags=($tags luigicolani design)
case *mocoloco*
tags=($tags mocoloco design)
case *sydmead*
tags=($tags sydmead design)
case *dzima*
tags=($tags dzima)
case *bbcicecream*
tags=($tags bbcicecream fashion)
case *DamStyle *damstyle*
tags=($tags damstyle fashion)
case *facehunter*
tags=($tags facehunter fashion)
case *StilInBerlin*
tags=($tags germany fashion)
case *jstreets*
tags=($tags jstreets japan fashion)
case *Stilinberlin*
tags=($tags stilinberlin germany fashion)
case *stylefromtokyo*
tags=($tags stylefromtokyo japan fashion)
case *tokyofashion*
tags=($tags tokyofashion japan fashion)
case *flames.gif* *flamesgif*
tags=($tags flames.gif)
case *contemporary-home-computing*
tags=($tags software flames.gif)
case *kurzweil*
tags=($tags kurzweil future)
case *longnow*
tags=($tags longnow future)
case *OpenTheFuture*
tags=($tags openthefuture future)
case *golang* *blog.nella.org*
tags=($tags golang)
case *googlepluses*
tags=($tags google)
case *news.ycombinator.com*
tags=($tags hackernews hack)
case *seanbonner*
tags=($tags sean_bonner hack)
case *banriman*
tags=($tags banriman japan)
case *japansubculture*
tags=($tags japansubculture japan)
case *jeansnow*
tags=($tags jeansnow japan)
case *Kotaku* *kotaku*
tags=($tags kotaku video_games)
case *eforemario*
tags=($tags before_mario video_games)
case *nakakobooks*
tags=($tags books nakakobooks japan)
case *ozawamaria*
tags=($tags maria_ozawa japan)
case *ibuya246*
tags=($tags shibuya246 japan)
case *shisaku.blogspot.com*
tags=($tags shisaku japan)
case *jimshooter*
tags=($tags comics jim_shooter)
case *LettersOfNote* *lettersofnote*
tags=($tags letters)
case *nasa*letters.rss*
tags=($tags nasa letters)
case *hellodamage* *manganews* *naokiurasawa* *samehat*
tags=($tags comics manga)
case *mangatraders*
tags=($tags p2p comics manga)
case *hortonheardawho*
tags=($tags hortonheardawho flickr nasa mars)
case *me-vs-gutenberg* *mevsgutenberg*
tags=($tags martin_sand)
case *marxy*
tags=($tags marxy)
case *etamodern*
tags=($tags metamodern)
case *aviationintel*
tags=($tags aviationintel mil)
case *aviationweek*
tags=($tags aviationweek mil)
case *codeonemagazine*
tags=($tags codeonemagazine mil)
case *geimint*
tags=($tags geimint mil)
case *bjork*
tags=($tags bjork music)
case *momus* *mrstsk*
tags=($tags books momus music)
case *toog*
tags=($tags toog music)
case *nasa.gov*
tags=($tags space nasa)
case *mongoliad*
tags=($tags neal_stephenson)
case *gaiman*
tags=($tags comics neil_gaiman)
case *nin.com* *feeds.nin.com*
tags=($tags music nin)
case *nix-os* *syssoftware*
tags=($tags plan9 nix)
case *bsdly* *OPENBSD* *OpenBSD* *openbsd* *scientist-home* *undeadly*
tags=($tags software openbsd)
case *godownmatthew* *mysticmilk* *petetoms*
tags=($tags pete_toms)
case *Pitchfork* *pitchfork*
tags=($tags music pitchfork)
case *9gridchan* *cat-v* *maht0x0r* *Plan9* *plan9*
tags=($tags software plan9)
case *FlauntTalks* *prince.org* *purpleinterviews* *wendyandlisa*
tags=($tags music prince)
case *commandcenter* *rob_pike*
tags=($tags golang plan9 rob_pike)
case *prometheus*
tags=($tags telescreen prometheus)
case *reddit.com*
tags=($tags reddit)
case *swtch.com*
tags=($tags golang plan9 rsc)
case *bunniestudios*
tags=($tags bunniestudios security)
case *jwz*
tags=($tags jwz security)
case *Krebs* *krebs*
tags=($tags krebs security)
case *scarybeastsecurity*
tags=($tags scarybeast security)
case *schneier*
tags=($tags bruce_schneier security)
case *chinchillakwak* *skwak*
tags=($tags skwak)
case *slashdot*
tags=($tags slashdot)
case *stanleylieber*
tags=($tags stanleylieber)
case *fastcompany*
tags=($tags fastcompany tech)
case *danharmon*
tags=($tags danharmon telescreen)
case *mindlessones*
tags=($tags mindlessones telescreen)
case *tcj.com*
tags=($tags comics tcj)
case *TEDblog* *ted.com*
tags=($tags ted)
case *ticom*
tags=($tags ticom security)
case *orrentfreak*
tags=($tags p2p torrentfreak)
case *ultra*culture*
tags=($tags ultraculture)
case *kleinletters*
tags=($tags comics todd_klein)
case *kennercollector*
tags=($tags kennercollector toys)
case *plaidstallions*
tags=($tags plaidstallions toys)
case *shojikawamori*
tags=($tags shojikawamori japan toys)
case *ruinedcartridge*
tags=($tags basscomm video_games)
}
echo -n $tags
}
fn parse_posts{
ifs='
' {
for(post in `{sort -r $file.work}){
if(! ~ $post ''){
a_title=`{echo $post | sed 's/^.*<h2 class="item-title"><div class="">//g' | sed 's/<div class="item-info">.*$//g' | htmlfmt}
if(~ $#a_title 0)
a_title=`{echo $post | sed 's/^.*<div class="item-info">//g' | sed 's/<div class="item-annotations">.*$//g' | htmlfmt}
if(~ $#a_title 0)
a_title=fake
a_link=`{echo $post | sed 's/^.*<h2 class="item-title"><div class="">//g' | sed 's/<div class="item-info">.*$//g' | htmlfmt -a | sed 's/^.*\[//g' | sed 's/\].*$//g' | sed 's/ .*$//g'}
if(~ $#a_link 0 || ! ~ $"a_link http*)
a_link=`{echo $post | sed 's/^.*<h2 class="item-title"><div class="">//g' | sed 's/<div class="item-info">.*$//g' | sed 's/^.*<a href="//g' | sed 's/\".*$//g' | sed 's/^.*http/http/g' | sed 's/ .*$//g'}
if(~ $#a_link 0 || ! ~ $"a_link http*)
a_link=`{echo $post | sed 's/^.*<div class="item-info">//g' | sed 's/<div class="item-annotations">.*$//g' | htmlfmt -a | sed 's/^.*\[//g' | sed 's/\].*$//g' | sed 's/ .*$//g'}
if(~ $#a_link 0 || ! ~ $"a_link http*)
a_link=`{echo $post | sed 's/^.*<div class="item-info">//g' | sed 's/<div class="item-annotations">.*$//g' | sed 's/^.*<a href="//g' | sed 's/" class="f">.*$//g' | sed 's/\".*$//g' | sed 's/^.*http/http/g' | sed 's/ .*$//g'}
a_link=$a_link(1)
if(~ $#a_link 0 || ~ $"a_link '' || ! ~ $"a_link http*)
a_link=fake
if(! ~ $#a_link 1)
a_link=`{echo $a_link | awk '{print $1;}'}
a_date=`{date -n}
a_body=`{echo $post | sed 's/^.*<div class="item-body">//g' | sed 's/<div class="clear">.*$//g'}
if(~ $#a_body 0)
a_body=fake
a_id=`{echo `{ls -p $werc/sites/$site/src | sort -n | tail -1}^+1 | bc}
if(~ $#a_id 0)
a_id=1
while(test -d $werc/sites/$site/src/$a_id)
a_id=`{echo $a_id^+1 | bc}
if(! ~ $"a_link `{cat $werc/sites/$site/src/*/link}){
mkdir -p $werc/sites/$site/src/$a_id/tags # big fat race
echo $"a_title >$werc/sites/$site/src/$a_id/title
echo $"a_date >$werc/sites/$site/src/$a_id/date
echo $"a_link >$werc/sites/$site/src/$a_id/link
echo $"a_body '</a></li></ul>' >$werc/sites/$site/src/$a_id/body
ifs=' ' {
for(j in `{get_tags}){
>$werc/sites/$site/src/$a_id/tags/$j
echo $a_id/tags/$j >>$werc/sites/$site/tags
}
}
}
if(test -f /boot/factotum)
for(i in `{f $werc/sites/$site/src/$a_id})
chmod +t $i
}
}
}
}
if(test -f /boot/factotum && test -f /rc/bin/hget)
webfs
get_feed
parse_posts

23
werc/apps/barf/bin/gt Executable file
View file

@ -0,0 +1,23 @@
#!/bin/rc
# Create an index of tags in $werc/sites/$site/tags. BULGE
# greps this index when running a search on a given tag.
# This file is also maintained by the bin/g* commands, or
# when adding posts through the web interface.
if(! ~ $#1 0)
base=$1
if not if(~ $#barf_root 1 && $#barf_base 1)
base=$barf_root/$"barf_base
if not
base=`{pwd}
if(test -f $base/_tags)
rm $base/_tags
builtin cd $base/src
ls -p |
sort -n |
xargs du -a |
sed 's/^.* //g' |
grep -e '^[0-9]*\/tags' |
grep -v -e '^.*\/tags$' >>$base/_tags
if(test -s $base/_tags)
cp $base/_tags $base/tags

455
werc/apps/barf/bin/gy Executable file
View file

@ -0,0 +1,455 @@
#!/bin/rc
# Parse XML RSS feeds from Yahoo Pipes into BARF blog posts
# for the specified site. If a post with a matching _link_ already
# exists, no new post will be created for that item. Accordingly,
# the gy script may run slowly for sites with a large number of
# existing posts. Tags will be created according to the rules
# defined in the get_tags() function.
#
# Requires 20h's xmlpull and rssread.
rfork en
switch($1){
case read
feed='http://pipes.yahoo.com/pipes/pipe.run?_id=d1f7146306b019d96d768facf95eebd9&_render=rss'
site=read.stanleylieber.com
tags=()
case *
echo 'Usage: gy [ ... ]' >[1=2]
exit usage
}
file=/tmp/gy.$1
werc=/usr/sl/www/werc
if(test -f /boot/factotum)
cmd=hget
if not
cmd='curl -s'
fn cram{
ssam '
,s/^link:.*$/HJDIVIDER&HJDIVIDER/g
,s/^title:.*$/HJDIVIDER&HJDIVIDER/g
,s/\n//g
,s/HJDIVIDERtitle:/\n&/g
'
}
fn scape{
ssam '
,s/ //g
,s/\&quot;/\"/g
,s/\&#34;/\"/g
,s/\&amp;/\&/g
,s/\&#38;/\&/g
,s/\&#39;/''/g
,s/\&#44;/,/g
,s/\&#45;/-/g
,s/\&#46;/\./g
,s/\&#47;/\//g
,s/\&#58;/:/g
,s/\&#59;/;/g
,s/\&lt;/</g
,s/\&#60;/</g
,s/\&#61;/=/g
,s/\&gt;/>/g
,s/\&#62;/>/g
,s/\&#95;/_/g
,s/\|/\&#124;/g
'
}
fn get_posts{
$"cmd $feed | rssread | cram | scape >$file
echo >>$file
}
fn get_tags{
switch($a_link){
case *1oct1993*
tags=($tags 1oct1993)
case *9front*
tags=($tags software plan9 9front)
case *organicmentalcore*
tags=($tags aleks)
case *amyearles* *etsy.com* *pushedunder* *seaglass* *woolandwater*
tags=($tags amy_earles)
case *animenewsnetwork*
tags=($tags telescreen anime)
case *spikejapan*
tags=($tags japan comics manga telescreen anime)
case *augmented.org*
tags=($tags augmented.org ar)
case *ArchDaily* *archdaily*
tags=($tags archdaily architecture)
case *bldgblog*
tags=($tags bldgblog architecture)
case *kazuyosejima*
tags=($tags japan architecture)
case *Minimalissimo*
tags=($tags minimalissimo design architecture)
case *ArtFagCity* *ArtFCity* *artfagcity*
tags=($tags artfagcity art)
case *rhizome-fp*
tags=($tags rhizome-fp art)
case *rhizome*
tags=($tags rhizome art)
case *starwarsmodern*
tags=($tags starwarsmodern art)
case *tokyoartbeat*
tags=($tags tokyoartbeat japan art)
case *trendbeheer*
tags=($tags trendbeheer art)
case *ValentinaTanni*
tags=($tags valentinatanni art)
case *vvork*
tags=($tags vwork art)
case *auriea* *tale-of-tales* *taleoftales*
tags=($tags auriea)
case *basscomm* *closeoutwarrior* *crummysocks* *gamerrelocationproject* *protipoftheday* *PushButtonB* *pushbuttonb*
tags=($tags video_games basscomm)
case *benjaminmarra*
tags=($tags comics benjamin_marra)
case *boingboing*
tags=($tags boingboing)
case *bushinbooks* *henka*
tags=($tags budo)
case *alexaanddave* *CEREBUS* *Cerebus* *cerebus* *davesim* *gerhard*
tags=($tags comics cerebus gerhard)
case *coilhouse*
tags=($tags coilhouse)
case *arche-arc*
tags=($tags arche comics)
case *bitolithic.com*
tags=($tags bitolithic comics)
case *blaiselarmee*
tags=($tags blaise_larmee comics)
case *bleedingcool*
tags=($tags bleedingcool comics)
case *bobgreenberger*
tags=($tags bob_greengerger comics)
case *coldheatcomics*
tags=($tags coldheat comics)
case *comicbookresources*
tags=($tags cbr comics)
case *comicsbeat*
tags=($tags comicsbeat comics)
case *ComicsComics* *comicscomics*
tags=($tags comicscomics comics)
case *coveredblog*
tags=($tags coveredblog comics)
case *dcfifty-too*
tags=($tags dcfifty-too comics)
case *Destructoid* *destructoid*
tags=($tags destructoid video_games)
case *economist.com*
tags=($tags economist)
case *brucesterling.tumblr.com*
tags=($tags bruce_sterling)
case *thecreatorsproject*
tags=($tags thecreatorsproject)
case *ferrandelgado*
tags=($tags ferran_delgado comics)
case *eddiecampbell*
tags=($tags eddie_campbell comics)
case *factualopinion*
tags=($tags factualopinion comics)
case *floating_world* *floatingworld*
tags=($tags floating_world comics)
case *frankmiller*
tags=($tags frank_miller comics)
case *humancolor*
tags=($tags humancolor comics)
case *jerkcity*
tags=($tags jerkcity comics)
case *maakies.com*
tags=($tags tony_millionaire maakies comics)
case *newconstructionblog*
tags=($tags newconstruction manga comics)
case *ohdannyboy*
tags=($tags ohdannyboy comics)
case *pulphope*
tags=($tags pulphope comics)
case *pwbeat*
tags=($tags pwbeat comics)
case *reliablecomics*
tags=($tags reliablecomics comics)
case *reneefrench*
tags=($tags renee_french comics)
case *rickveitch*
tags=($tags rick_veitch comics)
case *royalboiler*
tags=($tags royalboiler comics)
case *smbc-comics*
tags=($tags smbc comics)
case *studygroup*
tags=($tags studygroup comics)
case *xkcd*
tags=($tags xkcd comics)
case *bowiesongs* *DavidBowie* *davidbowie*
tags=($tags music david_bowie)
case *designboom*
tags=($tags designboom design)
case *dezeen*
tags=($tags dezeen design)
case *infosthetics*
tags=($tags infosthetics design)
case *inhabitat*
tags=($tags inhabitat architecture design)
case *luigicolani*
tags=($tags luigicolani design)
case *mocoloco*
tags=($tags mocoloco design)
case *sydmead*
tags=($tags sydmead design)
case *dzima*
tags=($tags dzima)
case *bbcicecream*
tags=($tags bbcicecream fashion)
case *DamStyle *damstyle*
tags=($tags damstyle fashion)
case *facehunter*
tags=($tags facehunter fashion)
case *StilInBerlin* *Stilinberlin*
tags=($tags germany fashion)
case *jstreets*
tags=($tags jstreets japan fashion)
case *stylefromtokyo*
tags=($tags stylefromtokyo japan fashion)
case *tokyofashion*
tags=($tags tokyofashion japan fashion)
case *flames.gif* *flamesgif*
tags=($tags flames.gif)
case *contemporary-home-computing*
tags=($tags software flames.gif)
case *acceler8or.com*
tags=($tags acceler8or future)
case *afrocyberpunk.wordpress.com*
tags=($tags afrocyberpunk future)
case *hyperallergic.com*
tags=($tags hyperallergic future)
case *kurzweil*
tags=($tags kurzweil future)
case *longnow*
tags=($tags longnow future)
case *OpenTheFuture*
tags=($tags openthefuture future)
case *theverge.com*
tags=($tags theverge future)
case *golang* *blog.nella.org*
tags=($tags golang)
case *googlepluses*
tags=($tags google)
case *news.ycombinator.com*
tags=($tags hackernews hack)
case *seanbonner*
tags=($tags sean_bonner hack)
case *banriman*
tags=($tags banriman japan)
case *japansubculture*
tags=($tags japansubculture japan)
case *jeansnow*
tags=($tags jeansnow japan)
case *Kotaku* *kotaku*
tags=($tags kotaku video_games)
case *eforemario*
tags=($tags before_mario video_games)
case *instagram* *web.stagram.com*
tags=($tags instagram)
case *nakakobooks*
tags=($tags books nakakobooks japan)
case *ozawamaria*
tags=($tags maria_ozawa japan)
case *Shibuya246*
tags=($tags shibuya246 japan)
case *shisaku.blogspot.com*
tags=($tags shisaku japan)
case *jimshooter*
tags=($tags comics jim_shooter)
case *LettersOfNote* *lettersofnote*
tags=($tags letters)
case *nasa*letters.rss*
tags=($tags nasa letters)
case *kore.livejournal.com*
tags=($tags kore livejournal)
case *real-funny-lady.livejournal.com*
tags=($tags rea_funny_lady livejournal)
case *vintage-ads.livejournal.com*
tags=($tags vintage_ads livejournal)
case *hellodamage*
tags=($tags comics hellodamage manga)
case *manganews*
tags=($tags comics manganews manga)
case *naokiurasawa*
tags=($tags comics naokiurasawa manga)
case *samehat*
tags=($tags comics samehat manga)
case *mangatraders*
tags=($tags p2p comics manga)
case *hortonheardawho*
tags=($tags hortonheardawho flickr nasa mars)
case *marstoday.com*
tags=($tags marstoday mars)
case *kielbryant*
tags=($tags kiel_bryant flickr)
case *flickr*paoru*
tags=($tags paoru flickr)
case *me-vs-gutenberg* *mevsgutenberg*
tags=($tags martin_sand)
case *marxy*
tags=($tags marxy)
case *etamodern*
tags=($tags metamodern)
case *aviationintel*
tags=($tags aviationintel mil)
case *aviationweek*
tags=($tags aviationweek mil)
case *codeonemagazine*
tags=($tags codeonemagazine mil)
case *geimint*
tags=($tags geimint mil)
case *momus* *mrstsk*
tags=($tags books music momus)
case *bjork*
tags=($tags bjork music)
case *c-h-r-i-s-c-a-r-t-e-r*
tags=($tags chris_carter music)
case *toog*
tags=($tags toog music)
case *nasa.gov*
tags=($tags space nasa)
case *mongoliad*
tags=($tags neal_stephenson)
case *gaiman*
tags=($tags comics neil_gaiman)
case *111567547782666546187*
tags=($tags daniel_rehn gplus)
case *114408853762245370512*
tags=($tags francesco_cardi gplus)
case *106673611724400311137*
tags=($tags mark_jondahl gplus)
case *113974084460235989118*
tags=($tags jose_nazario gplus)
case *102089697005520721324*
tags=($tags zaki_hasan gplus)
case *nin.com* *feeds.nin.com*
tags=($tags music nin.com nin)
case *ninofficialnews.tumblr.com*
tags=($tags music tumblr nin)
case *nix-os* *syssoftware*
tags=($tags plan9 nix)
case *bsdly* *OPENBSD* *OpenBSD* *openbsd* *scientist-home* *undeadly*
tags=($tags software openbsd)
case *godownmatthew* *mysticmilk* *petetoms*
tags=($tags pete_toms)
case *Pitchfork* *pitchfork*
tags=($tags music pitchfork)
case *9gridchan* *cat-v* *maht0x0r* *Plan9* *plan9*
tags=($tags software plan9)
case *FlauntTalks* *prince.org* *purpleinterviews* *wendyandlisa*
tags=($tags music prince)
case *101960720994009339267*
tags=($tags gplus rob_pike)
case *commandcenter* *rob_pike*
tags=($tags blogger rob_pike)
case *prometheus*
tags=($tags telescreen prometheus)
case *reddit.com*
tags=($tags reddit)
case *swtch.com*
tags=($tags golang plan9 rsc)
case *bunniestudios*
tags=($tags bunniestudios security)
case *jwz*
tags=($tags jwz security)
case *Krebs* *krebs*
tags=($tags krebs security)
case *scarybeastsecurity*
tags=($tags scarybeast security)
case *schneier*
tags=($tags bruce_schneier security)
case *chinchillakwak* *skwak*
tags=($tags skwak)
case *slashdot*
tags=($tags slashdot)
case *spaceref.com*
tags=($tags space spaceref)
case *StanleyLieber* *stanleylieber*
tags=($tags stanleylieber)
case *fastcompany*
tags=($tags fastcompany tech)
case *gizchina.com*
tags=($tags gizchina tech)
case *danharmon*
tags=($tags danharmon telescreen)
case *mindlessones*
tags=($tags mindlessones telescreen)
case *tcj.com*
tags=($tags comics tcj)
case *TEDBlog* *TEDblog* *ted.com*
tags=($tags ted)
case *ticom*
tags=($tags ticom security)
case *orrentfreak*
tags=($tags p2p torrentfreak)
case *ultra*culture*
tags=($tags ultraculture)
case *kleinletters*
tags=($tags comics todd_klein)
case *collectiondx.com*
tags=($tags collectiondx toys)
case *kennercollector.com*
tags=($tags kennercollector toys)
case *plaidstallions*
tags=($tags plaidstallions toys)
case *shojikawamori*
tags=($tags shojikawamori japan toys)
case *tumblr*
tags=($tags tumblr)
case *ruinedcartridge*
tags=($tags ruinedcartridge basscomm video_games)
}
echo -n $tags
}
fn parse_posts{
ifs='
' {
posts=`{cat $file}
for(i in `{seq 1 $#posts | sort -nr}){
post=$posts($i)
if(! ~ $post ''){
a_title=`{echo $post | sed 's/^.*HJDIVIDERtitle: //g; s/HJDIVIDER.*$//g'}
a_date=`{date}
a_link=`{echo $post | sed 's/^.*HJDIVIDERlink: //g; s/HJDIVIDER.*$//g'}
a_body=`{echo $post | sed 's/^.*HJDIVIDER//g; s/^.*HJDIVIDER//g; s/^.*HJDIVIDER//g'}
a_id=`{echo `{ls -p $werc/sites/$site/src | sort -n | tail -1}^+1 | bc}
if(~ $#a_id 0)
a_id=1
while(test -d $werc/sites/$site/src/$a_id)
a_id=`{echo $a_id^+1 | bc}
if(! ~ $"a_link '' && ! grep -s `{echo $"a_link | md5sum} $werc/sites/$site/links){
mkdir -p $werc/sites/$site/src/$a_id/tags # big fat race
echo $"a_title >$werc/sites/$site/src/$a_id/title
echo $"a_date >$werc/sites/$site/src/$a_id/date
echo $a_link(1) >$werc/sites/$site/src/$a_id/link
echo $a_link(1) | md5sum >>$werc/sites/$site/links
echo $"a_body '</a></li></ul>' >$werc/sites/$site/src/$a_id/body
ifs=' ' {
for(j in `{get_tags}){
>$werc/sites/$site/src/$a_id/tags/$j
echo $a_id/tags/$j >>$werc/sites/$site/tags
}
}
}
if(test -f /boot/factotum && ~ $site *.stanleylieber.com && test -d $werc/sites/$site/src/$a_id)
chmod +t $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id/* $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id/tags/*
}
}
}
}
if(test -f /boot/factotum && test -f /rc/bin/hget)
webfs
get_posts
parse_posts

119
werc/apps/barf/bin/gz Executable file
View file

@ -0,0 +1,119 @@
#!/bin/rc
# Parse XML RSS feeds into BARF blog posts for the specified site.
# If a post with a matching _link_ already exists, no new post will
# be created for that item. Tags will be created according to the rules
# defined in the get_tags() function.
#
# The file argument should point to a file containing one line per feed,
# with fields separated by the | character, in the following format:
#
# http://feeds.feedburner.com/ImNotReallyStanleyLieber|stanleylieber
#
# where the first field is the feed URL and each addition field is a tag.
#
# Requires 20h's xmlpull and rssread.
rfork en
switch($1){
case /*
feeds=$1
site=read.stanleylieber.com
tags=()
case *
echo 'Usage: gz file' >[1=2]
exit usage
}
file=/tmp/gz.$pid
werc=/usr/sl/www/werc
if(test -f /boot/factotum)
cmd=hget
if not
cmd='curl -s'
fn cram{
ssam '
,s/^link:.*$/HJDIVIDER&HJDIVIDER/g
,s/^title:.*$/HJDIVIDER&HJDIVIDER/g
,s/\n//g
,s/HJDIVIDERtitle:/\n&/g
'
}
fn scape{
ssam '
,s/ //g
,s/\&quot;/\"/g
,s/\&#34;/\"/g
,s/\&amp;/\&/g
,s/\&#38;/\&/g
,s/\&#39;/''/g
,s/\&#44;/,/g
,s/\&#45;/-/g
,s/\&#46;/\./g
,s/\&#47;/\//g
,s/\&#58;/:/g
,s/\&#59;/;/g
,s/\&lt;/</g
,s/\&#60;/</g
,s/\&#61;/=/g
,s/\&gt;/>/g
,s/\&#62;/>/g
,s/\&#95;/_/g
,s/\|/\&#124;/g
'
}
fn get_posts{
$"cmd $"feed | rssread | cram | scape >$file
echo >>$file
}
fn parse_posts{
ifs='
' {
posts=`{cat $file}
for(i in `{seq 1 $#posts | sort -nr}){
post=$posts($i)
if(! ~ $post ''){
a_title=`{echo $post | sed 's/^.*HJDIVIDERtitle: //g; s/HJDIVIDER.*$//g'}
a_date=`{date}
a_link=`{echo $post | sed 's/^.*HJDIVIDERlink: //g; s/HJDIVIDER.*$//g'}
a_body=`{echo $post | sed 's/^.*HJDIVIDER//g; s/^.*HJDIVIDER//g; s/^.*HJDIVIDER//g'}
a_id=`{echo `{ls -p $werc/sites/$site/src | sort -n | tail -1}^+1 | bc}
if(~ $#a_id 0)
a_id=1
while(test -d $werc/sites/$site/src/$a_id)
a_id=`{echo $a_id^+1 | bc}
if(! ~ $"a_link '' && ! grep -s `{echo $"a_link | md5sum} $werc/sites/$site/links){
mkdir -p $werc/sites/$site/src/$a_id/tags # big fat race
echo $"a_title >$werc/sites/$site/src/$a_id/title
echo $"a_date >$werc/sites/$site/src/$a_id/date
echo $a_link(1) >$werc/sites/$site/src/$a_id/link
echo $a_link(1) | md5sum >>$werc/sites/$site/links
if(~ $a_link(1) *staticflickr.com*)
echo '<img src="'$"a_link'">' >$werc/sites/$site/src/$a_id/body
echo $"a_body '</a></li></ul>' >>$werc/sites/$site/src/$a_id/body
ifs=' ' {
for(j in $tags){
>$werc/sites/$site/src/$a_id/tags/$j
echo $a_id/tags/$j >>$werc/sites/$site/tags
}
}
}
if(test -f /boot/factotum && ~ $site *.stanleylieber.com && test -d $werc/sites/$site/src/$a_id)
chmod +t $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id/* $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id/tags/*
}
}
}
}
if(test -f /boot/factotum && test -f /rc/bin/hget)
webfs
for(i in `{grep -v -e '^#' $feeds}){
feed=`{echo $"i | sed 's/\|.*$//g'}
tags=`{echo $"i | sed 's/\|/ /g'}
tags=$tags(2-)
get_posts
parse_posts
}

119
werc/apps/barf/bin/gz.read Executable file
View file

@ -0,0 +1,119 @@
#!/bin/rc
# Parse XML RSS feeds into BARF blog posts for the specified site.
# If a post with a matching _link_ already exists, no new post will
# be created for that item. Tags will be created according to the rules
# defined in the get_tags() function.
#
# The file argument should point to a file containing one line per feed,
# with fields separated by the | character, in the following format:
#
# http://feeds.feedburner.com/ImNotReallyStanleyLieber|stanleylieber
#
# where the first field is the feed URL and each addition field is a tag.
#
# Requires 20h's xmlpull and rssread.
rfork en
switch($1){
case /*
feeds=$1
site=read.stanleylieber.com
tags=()
case *
echo 'Usage: gz file' >[1=2]
exit usage
}
file=/tmp/gz.$pid
werc=/usr/sl/www/werc
if(test -f /boot/factotum)
cmd=hget
if not
cmd='curl -s'
fn cram{
ssam '
,s/^link:.*$/HJDIVIDER&HJDIVIDER/g
,s/^title:.*$/HJDIVIDER&HJDIVIDER/g
,s/\n//g
,s/HJDIVIDERtitle:/\n&/g
'
}
fn scape{
ssam '
,s/ //g
,s/\&quot;/\"/g
,s/\&#34;/\"/g
,s/\&amp;/\&/g
,s/\&#38;/\&/g
,s/\&#39;/''/g
,s/\&#44;/,/g
,s/\&#45;/-/g
,s/\&#46;/\./g
,s/\&#47;/\//g
,s/\&#58;/:/g
,s/\&#59;/;/g
,s/\&lt;/</g
,s/\&#60;/</g
,s/\&#61;/=/g
,s/\&gt;/>/g
,s/\&#62;/>/g
,s/\&#95;/_/g
,s/\|/\&#124;/g
'
}
fn get_posts{
$"cmd $"feed | rssread | cram | scape >$file
echo >>$file
}
fn parse_posts{
ifs='
' {
posts=`{cat $file}
for(i in `{seq 1 $#posts | sort -nr}){
post=$posts($i)
if(! ~ $post ''){
a_title=`{echo $post | sed 's/^.*HJDIVIDERtitle: //g; s/HJDIVIDER.*$//g'}
a_date=`{date}
a_link=`{echo $post | sed 's/^.*HJDIVIDERlink: //g; s/HJDIVIDER.*$//g'}
a_body=`{echo $post | sed 's/^.*HJDIVIDER//g; s/^.*HJDIVIDER//g; s/^.*HJDIVIDER//g'}
a_id=`{echo `{ls -p $werc/sites/$site/src | sort -n | tail -1}^+1 | bc}
if(~ $#a_id 0)
a_id=1
while(test -d $werc/sites/$site/src/$a_id)
a_id=`{echo $a_id^+1 | bc}
if(! ~ $"a_link '' && ! grep -s `{echo $"a_link | md5sum} $werc/sites/$site/links){
mkdir -p $werc/sites/$site/src/$a_id/tags # big fat race
echo $"a_title >$werc/sites/$site/src/$a_id/title
echo $"a_date >$werc/sites/$site/src/$a_id/date
echo $a_link(1) >$werc/sites/$site/src/$a_id/link
echo $a_link(1) | md5sum >>$werc/sites/$site/links
if(~ $a_link(1) *staticflickr.com*)
echo '<img src="'$"a_link'">' >$werc/sites/$site/src/$a_id/body
echo $"a_body '</a></li></ul>' >>$werc/sites/$site/src/$a_id/body
ifs=' ' {
for(j in $tags){
>$werc/sites/$site/src/$a_id/tags/$j
echo $a_id/tags/$j >>$werc/sites/$site/tags
}
}
}
if(test -f /boot/factotum && ~ $site *.stanleylieber.com && test -d $werc/sites/$site/src/$a_id)
chmod +t $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id/* $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id/tags/*
}
}
}
}
if(test -f /boot/factotum && test -f /rc/bin/hget)
webfs
for(i in `{grep -v -e '^#' $feeds}){
feed=`{echo $"i | sed 's/\|.*$//g'}
tags=`{echo $"i | sed 's/\|/ /g'}
tags=$tags(2-)
get_posts
parse_posts
}

119
werc/apps/barf/bin/gz.tumblr Executable file
View file

@ -0,0 +1,119 @@
#!/bin/rc
# Parse XML RSS feeds into BARF blog posts for the specified site.
# If a post with a matching _link_ already exists, no new post will
# be created for that item. Tags will be created according to the rules
# defined in the get_tags() function.
#
# The file argument should point to a file containing one line per feed,
# with fields separated by the | character, in the following format:
#
# http://feeds.feedburner.com/ImNotReallyStanleyLieber|stanleylieber
#
# where the first field is the feed URL and each addition field is a tag.
#
# Requires 20h's xmlpull and rssread.
rfork en
switch($1){
case /*
feeds=$1
site=tumblr.stanleylieber.com
tags=()
case *
echo 'Usage: gz file' >[1=2]
exit usage
}
file=/tmp/gz.$pid
werc=/usr/sl/www/werc
if(test -f /boot/factotum)
cmd=hget
if not
cmd='curl -s'
fn cram{
ssam '
,s/^link:.*$/HJDIVIDER&HJDIVIDER/g
,s/^title:.*$/HJDIVIDER&HJDIVIDER/g
,s/\n//g
,s/HJDIVIDERtitle:/\n&/g
'
}
fn scape{
ssam '
,s/ //g
,s/\&quot;/\"/g
,s/\&#34;/\"/g
,s/\&amp;/\&/g
,s/\&#38;/\&/g
,s/\&#39;/''/g
,s/\&#44;/,/g
,s/\&#45;/-/g
,s/\&#46;/\./g
,s/\&#47;/\//g
,s/\&#58;/:/g
,s/\&#59;/;/g
,s/\&lt;/</g
,s/\&#60;/</g
,s/\&#61;/=/g
,s/\&gt;/>/g
,s/\&#62;/>/g
,s/\&#95;/_/g
,s/\|/\&#124;/g
'
}
fn get_posts{
$"cmd $"feed | rssread | cram | scape >$file
echo >>$file
}
fn parse_posts{
ifs='
' {
posts=`{cat $file}
for(i in `{seq 1 $#posts | sort -nr}){
post=$posts($i)
if(! ~ $post ''){
a_title=`{echo $post | sed 's/^.*HJDIVIDERtitle: //g; s/HJDIVIDER.*$//g'}
a_date=`{date}
a_link=`{echo $post | sed 's/^.*HJDIVIDERlink: //g; s/HJDIVIDER.*$//g'}
a_body=`{echo $post | sed 's/^.*HJDIVIDER//g; s/^.*HJDIVIDER//g; s/^.*HJDIVIDER//g'}
a_id=`{echo `{ls -p $werc/sites/$site/src | sort -n | tail -1}^+1 | bc}
if(~ $#a_id 0)
a_id=1
while(test -d $werc/sites/$site/src/$a_id)
a_id=`{echo $a_id^+1 | bc}
if(! ~ $"a_link '' && ! grep -s `{echo $"a_link | md5sum} $werc/sites/$site/links){
mkdir -p $werc/sites/$site/src/$a_id/tags # big fat race
echo $"a_title >$werc/sites/$site/src/$a_id/title
echo $"a_date >$werc/sites/$site/src/$a_id/date
echo $a_link(1) >$werc/sites/$site/src/$a_id/link
echo $a_link(1) | md5sum >>$werc/sites/$site/links
if(~ $a_link(1) *staticflickr.com*)
echo '<img src="'$"a_link'">' >$werc/sites/$site/src/$a_id/body
echo $"a_body '</a></li></ul>' >>$werc/sites/$site/src/$a_id/body
ifs=' ' {
for(j in $tags){
>$werc/sites/$site/src/$a_id/tags/$j
echo $a_id/tags/$j >>$werc/sites/$site/tags
}
}
}
if(test -f /boot/factotum && ~ $site *.stanleylieber.com && test -d $werc/sites/$site/src/$a_id)
chmod +t $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id/* $werc/sites/$site/src/$a_id $werc/sites/$site/src/$a_id/tags/*
}
}
}
}
if(test -f /boot/factotum && test -f /rc/bin/hget)
webfs
for(i in `{grep -v -e '^#' $feeds}){
feed=`{echo $"i | sed 's/\|.*$//g'}
tags=`{echo $"i | sed 's/\|/ /g'}
tags=$tags(2-)
get_posts
parse_posts
}

3
werc/apps/barf/bin/rsrc Executable file
View file

@ -0,0 +1,3 @@
#!/bin/rc
# Remove static files.
rm -r [0-9]*.html [0-9]*-[0-9]*.html tag

4
werc/apps/barf/bin/srct Executable file
View file

@ -0,0 +1,4 @@
#!/bin/rc
# do not store these files in the worm
fn f{ du -a $* | sed 's/^.* //g' }
for(i in `{f $1}){ chmod +t $i }