Skip to content

Instantly share code, notes, and snippets.

Avatar

Glen Maddern geelen

View GitHub Profile
View gist:89105
#!/opt/local/bin/ruby
#list_suspected_duplicates.rb
dir = *ARGV
raise "usage: #{$0} base_dir" unless dir
puts "Working in #{dir}"
rars = Dir.glob(File.join(dir, "**", "*.rar")).map { |f| File.dirname(f) }.uniq.sort
View gist:93446
package guestbook
import _root_.com.google.appengine.api.users.{UserService, User, UserServiceFactory}
import _root_.javax.servlet.http.{HttpServletResponse, HttpServletRequest, HttpServlet}
import _root_.scala.collection.jcl.{Buffer, Conversions}
import _root_.scala.xml.Elem
import org.apache.taglibs.standard.functions.Functions
class GuestbookServlet extends HttpServlet {
override def doGet(req: HttpServletRequest, resp: HttpServletResponse) {
View gist:93465
def greetingsDescriptor(gs: List[Greeting]): List[Elem] = gs match {
case List() => List(<p>The guestbook has no messages.</p>)
case _ => gs.map(greetingDescriptor)
}
[scalac] /Users/glen/src/Guestbook/src/guestbook/GuestbookServlet.scala:70: error: type mismatch;
[scalac] found : scala.xml.Elem
[scalac] required: List[scala.xml.Elem]
[scalac] <p>The guestbook has no messages.</p>
[scalac] ^
View gist:94550
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Request Details</title>
</head>
<body>
<div>
{
List(("Method", method),
("URI Path", uri.path.mkString),
("URI Query String", uri.queryString map (_.mkString) getOrElse <i>N/A</i>),
View gist:96365
package slinky.demo
import collection.jcl.Conversions
import java.util.logging.Logger
object Edge {
val logger: Logger = Logger.getLogger(classOf[Edge].getName)
def exec[A](query: String) : A = PMF.pmfInstance.getPersistenceManager.newQuery(query).execute().asInstanceOf[A]
def execList[A](query: String) = {
View gist:100965
2009-04-23 23:39:45] INFO [KahunaExecution] - Running: KahunaQueryParametersImpl[
multiDurationQueryParameters=MultiDurationQueryParametersImpl[
packs=[PackImpl[
signs=[1255, 1262, 1266, 311, 303, 294, 309, 603, 1288, 1290, 1121, 1130, 1103, 1113, 1192, 745, 749, 544, 547, 557, 830, 826, 355, 364, 560, 384, 596, 594, 392, 45, 57, 100, 50, 91, 98, 59, 95, 128, 107, 93, 114, 1
10, 1642, 1053, 1051, 1300, 1305, 1302, 1504, 1495, 1507, 1501, 1602, 1605, 1597, 1529, 1515, 1549, 1558, 576, 570, 893, 879, 532, 524, 509, 319, 1205, 1209, 1465, 1490, 967, 1002, 399, 1010, 1008, 1566, 1279, 610, 622, 654, 90
3, 222, 221, 229, 469, 974, 630, 1318, 1316, 288, 250, 246, 245, 1024, 1021, 1337, 1358, 1016, 1014, 891, 890, 883, 931, 938, 937, 1585, 1579, 482, 691, 692, 703, 705, 904, 911, 437, 431, 428, 449, 1216, 1377, 1382, 659, 661, 9
42, 811, 803, 667, 1146, 1618, 1610, 1613, 1410, 1418, 1423, 200, 202, 262, 259, 334, 330, 983, 985, 987, 816, 152, 719, 721, 1283, 1183, 405, 1637, 921, 998, 1030,
View gist:100977
Processing KahunaController#deposit_result (for 174.129.105.26 at 2009-04-23 23:40:57) [POST]
Session ID: 76b210ae949d821ead6c477bc47e8bcf
Parameters: {"action"=>"deposit_result", "id"=>"617", "keys: "=>{}, "controller"=>"kahuna"}
save_result = {"keys"=>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], "population"=>2272998, "url"=>"http://move-maps.s3.amazonaws.com/map_1240530055733.kmz", "average_frequency"=>7.58637968137317, "status"=>"success", "counts"=>[203071, 146660, 115585, 95112, 80655, 68425, 59416, 50971, 44408, 38446, 33153, 29067, 24682, 21651, 18784, 16429, 14213, 12703, 10921, 9623, 8545, 7632, 6676, 5862, 5143, 4776, 4135, 38926]}
Completed in 0.99317 (1 reqs/sec) | Rendering: 0.00008 (0%) | DB: 0.65227 (65%) | 200 OK [http://ams.moveoutdoor.com.au/kahuna/deposit_result/617]
View gist:121382
dev@gordon:/data/lost+found$ ll -d `find -name zone_allocated_trips`
drwxr-xr-x 4 dev dev 34 2008-12-24 14:00 ./1073742080/zone_allocated_trips
drwxr-xr-x 3 dev dev 20 2009-01-21 23:15 ./1074388328/zone_allocated_trips
drwxr-xr-x 3 dev dev 20 2009-01-22 08:57 ./1637297966/zone_allocated_trips
drwxr-xr-x 4 dev dev 34 2008-11-05 12:07 ./1637297967/zone_allocated_trips
drwxr-xr-x 4 dev dev 34 2009-04-07 16:11 ./1743042303/zone_allocated_trips
drwxr-xr-x 4 dev dev 34 2009-01-19 14:41 ./203241/zone_allocated_trips
drwxr-xr-x 3 dev dev 20 2009-01-05 17:23 ./203242/zone_allocated_trips
drwxr-xr-x 3 dev dev 20 2008-10-30 13:50 ./2175452285/zone_allocated_trips
drwxr-xr-x 3 dev dev 20 2009-01-10 12:23 ./2177935941/zone_allocated_trips
View gist:124076
Fri 14:57:17 glen@swineflu ~/src/git-admo/admo ADMOD-1829
$ gits
# On branch ADMOD-1829
nothing to commit (working directory clean)
Fri 14:59:32 glen@swineflu ~/src/git-admo/admo ADMOD-1829
$ git push ci ADMOD-1829:ci
To ssh://glen-ci.local/~glen/src/git-admo
! [rejected] ADMOD-1829 -> ci (non-fast forward)
error: failed to push some refs to 'ssh://glen-ci.local/~glen/src/git-admo'
Fri 14:59:38 glen@swineflu ~/src/git-admo/admo ADMOD-1829
View gist:137945
namespace :ec2 do
desc "List suggested raw ubuntu server AMIs"
task :list_raw_amis do
query = if $command_line_options[:version].nil?
puts "use with_version=x.xx for refined search"
""
else
"| grep #{$command_line_options[:version]}"
end
puts `ec2-describe-images -a | grep ubuntu #{query}`
You can’t perform that action at this time.