This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
require 'xmlrpc/client' | |
typo = XMLRPC::Client.new('blog.host.name', '/backend/xmlrpc') | |
posts = typo.call('metaWeblog.getRecentPosts', '1', 'username', 'password', 1_000_000).select{|p| !p['description'].nil?}.collect do |post| | |
{'title' => post['title'], | |
'body' => post['description'], | |
'body_converter' => post['mt_convert_breaks'], | |
'tags' => post['mt_keywords'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Some sample code for a horizontal paged UIScrollView with a gap between each image (which looks nicer). Note - not using contentInset, we want each page to fill the iPhone screen and the gap only to be visible when scrolling (like Photos.app). | |
Taking the iPhone status bar into account - our viewport is 320x460 | |
Our UIScrollView is therefore set in Interface Builder to 340x460 with a -10 X offset (so it's larger than the viewport but still centred) | |
Then we do the following... | |
*/ | |
// Our image filenames |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> | |
<service_bundle type="manifest" name="sphinx"> | |
<service name="network/sphinx" type="service" version="0"> | |
<dependency name="fs" grouping="require_all" restart_on="none" type="service"> | |
<service_fmri value="svc:/system/filesystem/local"/> | |
</dependency> | |
<dependency name="net" grouping="require_all" restart_on="none" type="service"> | |
<service_fmri value="svc:/network/loopback"/> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEFAULT_OPTIONS.keys.each do |key| | |
define_method key do | |
return options[key.to_sym] unless options.nil? | |
end | |
define_method "#{key}=".to_sym do |value| | |
returning(options || {}) do |opt| | |
options[key.to_sym] = value | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
import java.net | |
import java.io | |
uri = java.net.URL.new("http://127.0.0.1") | |
con = uri.openConnection() | |
con.setConnectTimeout(1000) # in millisecs so this is 1 sec | |
con.setReadTimeout(1000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toto@glow:~$ /usr/bin/rsync --version | |
rsync version 2.6.9 protocol version 29 | |
Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others. | |
<http://rsync.samba.org/> | |
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles, | |
inplace, IPv6, 64-bit system inums, 64-bit internal inums | |
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you | |
are welcome to redistribute it under certain conditions. See the GNU |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
require 'rubygems' | |
gem 'xmpp4r-simple' | |
gem 'grit' | |
require 'xmpp4r-simple' | |
require 'grit' | |
include Grit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Uses some commands to determine the OpenSolaris system state and | |
require 'rubygems' | |
gem 'twitter' | |
require 'twitter' | |
ME_ON_TWITTER = 'mrtoto' | |
httpauth = Twitter::HTTPAuth.new('email', 'password') | |
$twitter = Twitter::Base.new(httpauth) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/local/bin/ruby | |
require 'rubygems' | |
require 'scrubyt' | |
require 'open-uri' | |
require 'builder' | |
LIMIT = 5 | |
res = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# For OpenSolaris | |
# The Bridge module from http://www.whiteboard.ne.jp/~admin2/tuntap/ | |
# brings a brdgadm tool | |
# Removing | |
# $1 is the interface which will be brought up | |
pfexec /usr/local/bin/brdgadm -d $1 | |
# the Network card name your system uses to connect to your local network | |
pfexec /usr/local/bin/brdgadm -d rge0 | |
pfexec /usr/local/bin/brdgadm -a $1 |