Skip to content

Instantly share code, notes, and snippets.

@hubgit
hubgit / google-reader-starred-to-delicious
Created March 29, 2009 17:16
Post starred items from Google Reader to Delicious
<?php
//$first_run = TRUE; // fetch all shared items from Google Reader on the first run
$id = 'YOUR_GOOGLE_ID_NUMBER';
$delicious = array(
'user' =>'YOUR_DELICIOUS_USERNAME',
'password' => 'YOUR_DELICIOUS_PASSWORD',
);
@hubgit
hubgit / http-authentication-proxy
Created April 3, 2009 15:16
Adding HTTP authentication parameters to a URL, proxying the result
<?php
$url = $_GET['url'];
$cookie = $_GET['cookie'];
$parts = parse_url($url);
$parts['user'] = $auth[$parts['host']]['user'];
$parts['pass'] = $auth[$parts['host']]['pass'];
@hubgit
hubgit / blank-html-template
Created April 5, 2009 15:02
A blank HTML Strict template
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Title</title>
<link rel="stylesheet" href="style.css"/>
<style></style>
<script src="script.js"></script>
@hubgit
hubgit / drupal-custom-403.php
Created April 5, 2009 15:04
Custom 403 page for Drupal 6 that provides a link to sign in
// Enable PHP filter module.
// Create a new node with this content.
// In Admin > Site Configuration > Error Reporting, set the default 403 page to this node.
Access to this page is restricted, please <?php print l(t('sign in'), 'user/login', array('query' => 'destination='. drupal_urlencode($_REQUEST['q']), 'absolute' => TRUE)); ?>.
@hubgit
hubgit / playdar-vattoz.php
Created April 5, 2009 17:22
Vattoz resolver for Playdar
#!/usr/bin/php
<?php
$in = fopen('php://STDIN','r');
// report our settings before entering the main query loop:
send_reply(get_settings());
// main loop: wait for a query, try and find match and reply.
while (!feof($in)){
@hubgit
hubgit / playdar-amazon.php
Created April 5, 2009 18:37
Amazon resolver for Playdar (30 sec clips only)
#!/usr/bin/php
<?php
define('AWSACCESSID', '1SVFNCKVJ7JWK2NPG002');
$in = fopen('php://STDIN','r');
// report our settings before entering the main query loop:
send_reply(get_settings());
@hubgit
hubgit / cpan-settings.sh
Created April 7, 2009 11:18
configuration settings for CPAN
o conf prerequisites_policy follow
o conf make_install_make_command 'sudo make'
o conf mbuild_install_build_command 'sudo ./Build'
o conf commit
@hubgit
hubgit / senseclusters.sh
Created April 7, 2009 14:28
text analysis using SenseClusters
cpan
install Text::NSP
#install Text::SenseClusters
nohup huge-count.pl dest-dir source-dir &
@hubgit
hubgit / tinyurl-datastore.php
Created April 8, 2009 13:14
Store data in TinyURL
<?php
// http://search.cpan.org/dist/WWW-WebStore-TinyURL/
// http://asserttrue.blogspot.com/2009/02/data-urls-to-tinyurls-and-vice-versa.html
$file = $argv[1];
print "Posting...\n";
$tinyurl = post_data($file);
print $tinyurl . "\n";
@hubgit
hubgit / reflect-journal-articles.php
Created April 28, 2009 12:15
Reflect as a proxy (freely available content only)
<?php
$response = file_get_contents('http://reflect.ws/ReflectProxy?' . http_build_query(array('url' => $url)));
if (strpos($response, 'http://reflect.ws/Reflection') === 0)
system(sprintf('open %s', escapeshellarg(trim($response))));
else
exit(sprintf("Error: %s\n", $response));