Skip to content

Instantly share code, notes, and snippets.

View mnutt's full-sized avatar

Michael Nutt mnutt

View GitHub Profile
public HashMap<String, Object> list(HashMap<String, String> options) {
List<HashMap<String, String>> items = new ArrayList<HashMap<String, String>>();
for(LocalFileItem file: managedList.getModel()) {
HashMap<String, String> item = new HashMap<String, String>();
item.put("file_name", file.getFileName());
item.put("sha1", file.getUrn().toString());
items.add(item);
}
function containsArray(haystack, needle) {
var matched = 0;
for(var i in haystack) {
if(haystack[i] == needle[matched]) {
matched = matched + 1;
if(matched == needle.length) {
return i - matched + 1;
}
} else { matched = 0; }

hid.im image format

A hidim is a torrent that is embedded inside of a 24-bit png. The data portion of a hidim does not need to fill the image.

Torrent data is read upward and to the right.

The torrent is broken up into 3-byte segments, and each segment represents red, green, and blue channels in a pixel.

$.each(results, function(index, result) {
if($('#'+result.sha1).length == 0) {
var treeItem = $(document.createElement('treeitem')).addClass('result').attr('id', result.sha1);
var treeRow = $(document.createElement('treerow'));
treeRow.append($(document.createElement('treecell')).addClass('space').attr('label', ' '));
treeRow.append($(document.createElement('treecell')).addClass('from').attr('label', result.sources));
if(result.properties.TITLE && result.properties.AUTHOR) {
treeRow.append($(document.createElement('treecell')).addClass('name').attr('label', result.properties.TITLE + " - " + result.properties.AUTHOR));
} else {
package com.aboxo.ajax;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.handler.*;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.servlet.ServletHandler;
import org.mortbay.jetty.servlet.Context;
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'vendor', 'rpodcast', 'lib'))
options = {}
ARGV.each do |arg|
key, value = arg.split('=')
options[key.intern] = value.to_i
end
options[:limit] ||= 1000
/* http://10.254.193.229:8080/links/search?query=and */
{
"class": "com.limewire.links.LinksResults",
"impressionId": 0,
"inlineResults": [
{
"albumId": 127,
"albumTitle": "Roll Out the Candy",
"artist": "Jim and the French Vanilla",
# Java:
public List<? extends SearchResult> getSearchResultsFromUrn(URN urn) {
List<SearchResult> urnResults = new ArrayList<SearchResult>();
for(SearchResult result : this.listener.searchResults) {
if(result.getUrn().toString().equals(urn.toString())) { urnResults.add(result); }
}
return urnResults;
}
# LIMEWIRE GEM in jruby...
require 'limewire'
LimeWire::Initializer.start_from_jar('vendor/limewire/LimeWire.jar')
LimeWire::Library.all.each do |item|
# do something
end
setting_name => type, [possible values], default value
share_downloaded_files => boolean, true
allow_document_sharing => boolean, true
add_audio_files_to_itunes => boolean, false
enable_daap_server => boolean, false
default_search_category => enum, ['all', 'audio', 'video', 'images', 'documents'], 'all'
search_files_from_friends => boolean, true
allow_search_for_programs => boolean, false