Skip to content

Instantly share code, notes, and snippets.

View peterlandry's full-sized avatar

Peter Landry peterlandry

  • Stavanger, Norway
View GitHub Profile
def test_fieldstorage_multipart_w3c_ubercore(self):
# Test basic FieldStorage multipart parsing (W3C sample)
BOUNDARY_UBERCORE = "4f6a9e85-0088-4ab0-9cf3-7f9948149807"
POSTDATA_UBERCORE = """--4f6a9e85-0088-4ab0-9cf3-7f9948149807
Content-Disposition: form-data; name="name"
Content-Type: text/plain; charset=UTF-8
Content-Length: 64
Content-Transfer-Encoding: binary
file:/storage/sdcard/Pictures/JPEG_20150728_101124_252379362.jpg
--4f6a9e85-0088-4ab0-9cf3-7f9948149807
Content-Disposition: form-data; name="name"
Content-Type: text/plain; charset=UTF-8
Content-Length: 64
Content-Transfer-Encoding: binary
file:/storage/sdcard/Pictures/JPEG_20150728_101124_252379362.jpg
--4f6a9e85-0088-4ab0-9cf3-7f9948149807
Content-Disposition: form-data; name="mimetype"
Content-Type: text/plain; charset=UTF-8
# salt-call archive.tar xvzf archive.tar.gz dest=/tmp/
[INFO ] Executing command 'tar -xvzf archive.tar.gz dest=/tmp/' in directory '/root'
local:
- tar: dest=/tmp: Not found in archive
- tar: Exiting with failure status due to previous errors
@peterlandry
peterlandry / gist:3188094
Created July 27, 2012 13:39
postgis module
class postgis {
package {
"postgresql": ensure => latest;
"postgis": ensure => latest;
"gdal-bin": ensure => latest;
"postgresql-8.4-postgis": ensure => latest;
"postgresql-server-dev-8.4": ensure => latest;
"libpq-dev": ensure => latest;
}
#!/usr/bin/env python
"""diffsplit.py
Takes a unified diff and produces two files.
Example usage:
./diffsplit.py unified.diff file1.py file2.py
"""
@peterlandry
peterlandry / gist:794138
Created January 24, 2011 22:44
ACS 2005-2009 geo record format
acs_geo_fields = [
('FILEID', 1, 6),
('STUSAB', 7, 2),
('SUMLEVEL', 9, 3),
('COMPONENT', 12, 2),
('LOGRECNO', 14, 7),
('US', 21, 1),
('REGION', 22, 1),
('DIVISION', 23, 1),
('STATECE', 24, 2),
$ rake db:migrate
(in /home/mapper/live/mapper)
no such file to load -- uploadcolumn
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/var/lib/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in `load'
/var/lib/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
config.action_controller.session = {
$ rake gems
(in /home/mapper/live/mapper)
- [I] calendar_date_select
- [I] hoptoad_notifier
- [R] activesupport
- [I] uploadcolumn
- [I] mislav-will_paginate ~> 2.3.8
- [I] prawn = 0.6.3
- [I] prawn-core >= 0.6.3, < 0.7
- [I] prawn-layout >= 0.3.2, < 0.4
public JsonResult GraphOne ( int week ) {
if ( week == 0 || week > 10 ) {
week = 11;
}
var dc = new PortalDataContext( );
List<object> actual = new List<object>( );
for ( int i = 0 ; i < week ; i++ ) {