Skip to content

Instantly share code, notes, and snippets.

View charlesroper's full-sized avatar
🌱

Charles Roper charlesroper

🌱
View GitHub Profile
@charlesroper
charlesroper / gist:65931
Created February 17, 2009 20:03
Method to detect whether we are running from an elevated command-prompt under Vista/Win7 or as part of the local Administrators group in WinXP.
#
# Method to detect whether we are running from an elevated command-prompt
# under Vista/Win7 or as part of the local Administrators group in WinXP.
#
def elevated?
whoami = `whoami /groups` rescue nil
if whoami =~ /S-1-16-12288/
true
else
admin = `net localgroup administrators | find "%USERNAME%"` rescue ""
From ffc228ef071f2a0bac2838d8451ad1f07c090701 Mon Sep 17 00:00:00 2001
From: Charles Roper <[email protected]>
Date: Thu, 30 Jul 2009 20:38:04 +0100
Subject: [PATCH] Added option to command-line tool for wrapping attribs with double-quotes
---
lib/haml/exec.rb | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/haml/exec.rb b/lib/haml/exec.rb
@charlesroper
charlesroper / tmsanitize4e.rb
Created August 12, 2009 09:57
A script to fix filenames that are incompatible with Windows.
#!/usr/bin/ruby
# tmsanitize4e.rb
# A script to sanitize filenames that are incompatible with Windows.
require 'uri'
require 'find'
require 'fileutils'
include FileUtils::Verbose
> rake spec
(in D:/Temp/rad_s3)
Running Integration Spec Task
C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/bin/ruby.exe -I "C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/cucumber-0.3.99/lib;lib" "C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/cucumber-0.3.99/bin/cucumber" --format progress C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/content_negotiation.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/layouts_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/pages_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/snippets_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/feature
> rake spec
(in D:/Temp/rad_s3)
Running Integration Spec Task
C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/bin/ruby.exe -I "C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/cucumber-0.3.99/lib;lib" "C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/cucumber-0.3.99/bin/cucumber" --format progress C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/content_negotiation.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/layouts_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/pages_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/snippets_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/feature
@charlesroper
charlesroper / TaxonDeterminationUpdate.xml
Created January 14, 2010 18:31
Adds a determination to every occurrence of taxa found in a specified CSV. The taxa must be defined in a column called 'Taxon_Name'.
<?xml version="1.0" ?>
<!--
XML Batch Update by Mike Weideli of Littlefield Consultancy
http://www.lfield.co.uk
January 2010
Modifications by Charles Roper of Sussex Biodiversity Record Centre
http://sxbrc.org.uk
January 2010
<?xml version="1.0" ?>
<!--
XML Batch Update by Mike Weideli of Littlefield Consultancy
http://www.lfield.co.uk
January 2010
Modifications by Charles Roper of Sussex Biodiversity Record Centre
http://sxbrc.org.uk
January 2010
declare
@date_start as int, @date_end as int
set @date_start = dbo.LCToRataDie('01/01/2005')
set @date_end = dbo.LCToRataDie('31/12/2009')
select distinct
txo.TAXON_OCCURRENCE_KEY
,itn2.PREFERRED_NAME as TAXON
,itn2.COMMON_NAME
TCC LE 11.00.40 Windows Vista [Version 6.0.6002]
Copyright 2010 Rex Conn & JP Software Inc. All Rights Reserved
[ C:\Users\charlesr ]
> pik sw
pik/batch_file.rb:18:in `read': Invalid argument - C:/Users/charlesr/Tools/bin/C:/Users/charlesr/Tools/bin/pik.bat (Errno::EINVAL)
from pik/batch_file.rb:18:in `initialize'
from pik/batch_file.rb:5:in `new'
from pik/batch_file.rb:5:in `open'
from pik/commands/command.rb:52:in `clean_gem_batch'
[ D:\ ]
> ruby -v && gem -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]
1.3.5
[ D:\ ]
> gem list compass --local
*** LOCAL GEMS ***