Skip to content

Instantly share code, notes, and snippets.

View mchelen's full-sized avatar

Mike Chelen (he/him) mchelen

View GitHub Profile
#!/bin/bash
# this script should be run as root with "sudo"
if [ `id -u` != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi
# add the freenx ppa repository list
add-apt-repository ppa:freenx-team
# update software information
apt-get update
<script src="http://github.com/jeresig/processing-js/raw/master/processing.min.js" type="text/javascript"></script>
<script src="http://github.com/jeresig/processing-js/raw/master/examples/init.js" type="text/javascript"></script>
<script type="text/javascript">
Array.max = function( array ) {
return Math.max.apply( Math, array );
};
Array.min = function( array ){
return Math.min.apply( Math, array );
};
</script>
<!DOCTYPE html>
<html>
<head>
<script src="http://github.com/jeresig/processing-js/raw/master/processing.min.js"></script>
<script src="http://github.com/jeresig/processing-js/raw/master/examples/init.js"></script>
<script type="text/javascript">
Array.max = function( array ){
return Math.max.apply( Math, array );
};
#!/bin/sh
# author: Michael Chelen http://mikechelen.com http://twitter.com/mikechelen
# license: Creative Commons Zero Public Domain http://creativecommons.org/publicdomain/zero/1.0/
# requires curlftpfs
# mirrors the XML files from Pubmed Central Open Access Subset FTP
# tested with Ubuntu Server 10.04
# ftp server and remote path
ftp=ftp.ncbi.nlm.nih.gov
ftppath=pub/pmc
#!/bin/sh
# author: Michael Chelen http://mikechelen.com http://twitter.com/mikechelen
# license: Creative Commons Zero Public Domain http://creativecommons.org/publicdomain/zero/1.0/
# requires curlftpfs
# mirrors the XML files from Pubmed Central Open Access Subset FTP
# tested with Ubuntu Server 10.04
# ftp server and remote path
ftp=ftp.ncbi.nlm.nih.gov
ftppath=pub/pmc
for I in A-B C-H I-N O-Z;
do
curfile=articles.$I.tar.gz
cururl=ftp://$ftp/$ftppath/$curfile
echo "Downloading $cururl to $tempdir"
# download file to temporary directory
wget -P $tempdir $cururl
# use up to 5 concurrent connections
# aria2c -d $tempdir -s 5 $cururl
echo "Exctracting $tempdir/$curfile to $filedir"
preg_match('/[0-9]+/', $_GET["pmcid"],$matches);
$pmc = $matches[0];
// generate list files command
$cmd = "ls $filepath/*/*-$pmc.nxml";
// run command and save results (trim whitespace)
$output = trim(shell_exec($cmd));
if (strlen($output)>0) {
// set http header type
header ("Content-Type:text/xml");
// output requested file
readfile($output);
}
@mchelen
mchelen / apikey.php
Created September 21, 2010 18:34
Klout Batch // Submits a list of names to Klout API to find influence and basic stats // Returns results in XML or JSON
<?php
// enter API key
$key = "****************";
?>
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDQFSzet/Qu8SLklDQyNbX5k16MwOBVKuaY9bNJhb99BkIRIVbNpr61eHUG3gP6haNC6qreTbpHscq4AQV21gLvCgVmHsTci0QAK44weFyDzVwIBFH9uUN+f/k2NTY9zV8FaBqK9CW8hS2f50EB38mGYvE7/0/S1u7/jtxnKqwAgw== htc_aria" >> authorized_keys