| Andrew Cooke | Contents | Latest | RSS | Twitter | Previous | Next

C[omp]ute

Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

Personal Projects

Lepl parser for Python.

Colorless Green.

Photography around Santiago.

SVG experiment.

Professional Portfolio

Calibration of seismometers.

Data access via web services.

Cache rewrite.

Extending OpenSSH.

C-ORM: docs, API.

Last 100 entries

TP-Link TL-WR841N DNS TCP Bug; TP-Link TL-WR841N as Wireless Bridge; Sending Email On Time; Maybe run a command; Sterile Neutrinos; Strawberry and Banana Jam; The Best Of All Possible Worlds; Kenzaburo Oe: The Changeling; Peach Jam; Taste Test; Strawberry and Raspberry Jam; flac to mp3 on OpenSuse 42.1; Also, Sebald; Kenzaburo Oe Interview; Otake (Kitani Minoru) move Black 121; Is free speech in British universities under threat?; I am actually good at computers; Was This Mansplaining?; WebFaction / LetsEncrypt / General Disappointment; Sensible Philosophy of Science; George Ellis; Misplaced Intuition and Online Communities; More Reading About Japan; Visibilty / Public Comments / Domestic Violence; Ferias de Santiago; More (Clearly Deliberate); Deleted Obit Post; And then a 50 yo male posts this...; We Have Both Kinds Of Contributors; Free Springer Books; Books on Religion; Books on Linguistics; Palestinan Electronica; Books In Anthropology; Taylor Expansions of Spacetime; Info on Juniper; Efficient Stream Processing; The Moral Character of Crypto; Hearing Aid Info; Small Success With Go!; Re: Quick message - This link is broken; Adding Reverb To The Echo Chamber; Sox Audio Tools; Would This Have Been OK?; Honesty only important economically before institutions develop; Stegangraphy via PS4; OpenCL Mess; More Book Recommendations; Good Explanation of Difference Between Majority + Minority; Musical Chairs - Who's The Privileged White Guy; I can see straight men watching this conversation and laffing; Meta Thread Defending POC Causes POC To Close Account; Indigenous People Of Chile; Curry Recipe; Interesting Link On Marginality; A Nuclear Launch Ordered, 1962; More Book Recs (Better Person); It's Nuanced, And I Tried, So Back Off; Marx; The Negative Of Positive; Jenny Holzer Rocks; Huge Article on Cultural Evolution and More; "Ignoring language theory"; Negative Finger Counting; Week 12; Communication Via Telecomm Bids; Finding Suspects Via Relatives' DNA From Non-Crime Databases; Statistics and Information Theory; Ice OK in USA; On The Other Hand; (Current Understanding Of) Chilean Taxes / Contributions; M John Harrison; Playing Games on a Cloud GPU; China Gamifies Real Life; Can't Help Thinking It's Thoughtcrime; Mefi Quotes; Spray Painting Bike Frame; Weeks 10 + 11; Change: No Longer Possible To Merge Metadata; Books on Old Age; Health Tree Maps; MRA - Men's Rights Activists; Writing Good C++14; Risk Assessment - Fukushima; The Future of Advertising and Surveillance; Travelling With Betaferon; I think I know what I dislike so much about Metafilter; Weeks 8 + 9; More; Pastamore - Bad Italian in Vitacura; History Books; Iraq + The (UK) Governing Elite; Answering Some Hard Questions; Pinochet: The Dictator's Shadow; An Outsider's Guide To Julia Packages; Nobody gives a shit; Lepton Decay Irregularity; An Easier Way; Julia's BinDeps (aka How To Install Cairo); Good Example Of Good Police Work (And Anonymity Being Hard); Best Santiago Burgers

© 2006-2015 Andrew Cooke (site) / post authors (content).

XML RPC with bash/netcat

From: "andrew cooke" <andrew@...>

Date: Sun, 8 Jan 2006 18:56:25 -0300 (CLST)

I was looking at technorati - http://www.technorati.com/ - and they
support an xml rpc "ping" to signal when a blog is updated.  I wondered
how easy it would be to add such a thing with bash - turns out it's
trivial.  Here's the code (it's not in the download source because I don't
want people pinging with my address and I don't trust people to configure
things, but you can cut + [aste from below)

Andrew

#! /bin/bash

# ping technorati

#set -v

# configuration
ADDRESS="http://www.acooke.org/cute"
NAME="C[omp]UTE"
# (end of configuration)

export PATH="$PATH:$CUTE_DIR/scripts"

tmp=`mktemp`
echo "<?xml version=\"1.0\"?>
<methodCall>
  <methodName>weblogUpdates.ping</methodName>
  <params>
    <param>
      <value>$NAME</value>
    </param>
    <param>
      <value>$ADDRESS</value>
    </param>
  </params>
</methodCall>" > "$tmp"

size=`cat "$tmp" | wc -c`

msg=`mktemp`
echo "POST /rpc/ping HTTP/1.0
User-Agent: bash script across netcat - andrew@...
Host: rpc.technorati.com
Content-Type: text/xml
Content-length: $size
" > "$msg"

cat "$tmp" >> "$msg"
rm "$tmp"
cat "$msg"
cat "$msg" | nc rpc.technorati.com 80
rm "$msg"

And an ATOM feed too...

From: "andrew cooke" <andrew@...>

Date: Sun, 8 Jan 2006 22:48:08 -0300 (CLST)

As you can see (the little orange icon) I've also added a basic ATOM feed.
 It's pretty impressive how simple these things are!

Testing Ping

From: "andrew cooke" <andrew@...>

Date: Sat, 1 Jul 2006 17:00:08 -0400 (CLT)

Hmmm.  Something was broken.  See if this fixes it....

Another Test (Unique IDs)

From: "andrew cooke" <andrew@...>

Date: Sun, 9 Jul 2006 18:11:14 -0400 (CLT)

I wasn't generating unique ID values for replies.  This should now work
(which means Technorati will not ignore them, I hope).

Andrew

Some thanks, and a modified version removing the depdency on Netcat

From: Atticus <grobe0ba@...>

Date: Fri, 27 Jun 2014 04:47:36 -0400

Thanks for the down and dirty on this. Below is a slightly modified version
removing the dependency on netcat.

#! /bin/bash

# ping technorati

#set -v

# configuration
ADDRESS="http://www.acooke.org/cute"
NAME="C[omp]UTE"
# (end of configuration)

export PATH="$PATH:$CUTE_DIR/scripts"

tmp=`mktemp`
echo "<?xml version=\"1.0\"?>
<methodCall>
  <methodName>weblogUpdates.ping</methodName>
  <params>
    <param>
      <value>$NAME</value>
    </param>
    <param>
      <value>$ADDRESS</value>
    </param>
  </params>
</methodCall>" > "$tmp"

size=`cat "$tmp" | wc -c`

msg=`mktemp`
echo "POST /rpc/ping HTTP/1.0
User-Agent: bash script across netcat - andrew@...
Host: rpc.technorati.com
Content-Type: text/xml
Content-length: $size
" > "$msg"

cat "$tmp" >> "$msg"
rm "$tmp"
cat "$msg"
#Open file descriptor 15 to rpc.technorati.com:80
exec 15<>/dev/tcp/rpc.technorati.com/80
cat $msg >&15
cat <&15 >/dev/null #Disgarding the return
#When the connection closes, cat returns, and bash closes file descriptor 15
rm "$msg"


--
Byron Grobe

Comment on this post