Skip to content

Instantly share code, notes, and snippets.

View olleolleolle's full-sized avatar
🙌
In sunny Malmö in Sweden 🌞

Olle Jonsson olleolleolle

🙌
In sunny Malmö in Sweden 🌞
View GitHub Profile
@olleolleolle
olleolleolle / rename-on-s3.rb
Last active August 29, 2015 14:04
Improved by adding another S3 DEFAULT_HOST, putting the keys on the command-line.
# This is a quick script for doing a mass rename of all files in an
# Amazon S3 bucket.
# In this case, the rename operation was to unescape all filenames which
# had been previously escaped in error.
#############################
# Configuration:
bucketname = ENV.fetch('S3_BUCKET_NAME')
access_key = ENV.fetch('S3_ACCESS_KEY_ID')
@olleolleolle
olleolleolle / Gemfile
Created September 1, 2014 13:05
Celluloid 0.16.0.pre3 issue description: When running these quite small actors in a supervised pool, they do not start they are not available in the Celluloid::Actor[] registry as they were in v0.15.2.
#gem 'celluloid', '>= 0.16.0.pre3'
gem 'celluloid', '>= 0.15.2'
gem 'rspec'

JavaScript Spessore Errata

This line reveals a typo:

delegateToOwn(Cell, 'state', ['alive', 'aliveInNextGeneration']);

Fix: The Alive and Dead objects should have aliveInNextGeneration function slots, not stateInNextGeneration as it is now.


@olleolleolle
olleolleolle / howto.md
Last active August 29, 2015 14:21
Reveal-md formatter for Cucumber: show the Scenarios and Features on a beamer.

HI!

You write Cucumber features for collaboration.

If you present them as flat plaintext, non-programmers won't read them.

Try, using Reveal.js and show the scenario texts on a beamer.

This is a guide on how to do it!

diff --git a/api/server/server.go b/api/server/server.go
index 1ad1249..82043ca 100644
--- a/api/server/server.go
+++ b/api/server/server.go
@@ -368,7 +368,8 @@ func (s *Server) getImagesJSON(version version.Version, w http.ResponseWriter, r
}
func (s *Server) getInfo(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
- info, err := s.daemon.SystemInfo()
+ osAsPrettyName := version.GreaterThanOrEqualTo("1.19")
func (s *DockerSuite) TestInfoApiPre121(c *check.C) {
status, body, err := sockRequest("GET", "/v1.20/info", nil)
c.Assert(err, check.IsNil)
c.Assert(status, check.Equals, http.StatusOK)
if !strings.Contains(string(body), "OperatingSystem") {
c.Errorf("couldn't find string OperatingSystem in output")
}
}
@olleolleolle
olleolleolle / gist:26094
Created November 18, 2008 10:22
A little bug, fixed.
Index: /Users/olle/opensource/python/pinax-readonly/projects/complete_project/templates/tribes/tribe.html
===================================================================
--- /Users/olle/opensource/python/pinax-readonly/projects/complete_project/templates/tribes/tribe.html (revision 1208)
+++ /Users/olle/opensource/python/pinax-readonly/projects/complete_project/templates/tribes/tribe.html (working copy)
@@ -132,7 +132,7 @@
{% tweet_listing tweets 1 0 %}
<h2>{% trans "Upcoming Events" %}</h2>
- {% get_calendar_for_object tribe as calendar %}
+ {% get_calendar tribe as calendar %}
@olleolleolle
olleolleolle / thing.py
Created November 19, 2008 15:15
My problem with Projects was that anyone could list projects that they were not a member of. I hate that.
import things
from django.db import connection
from django.http import HttpResponse, Http404
from django.template import RequestContext
from things.fields import BaseField, AggregateBase, DESCENDING
from django.template.loader import select_template
class ProjectThing(things.Thing):
created = things.OrderField(
if (column && column.editor && column.editor.field && ( column.editor.field.isXType('eosnumberfield') || column.editor.field.isXType('eosdirectentryfield') ) ) {
//top.dl('keyCode:' + e.keyCode + '/charCode:'+e.charCode+ '/fromCharCode:'+String.fromCharCode(e.charCode));
valueForEditor = String.fromCharCode(e.getCharCode());
}
@olleolleolle
olleolleolle / mediawiki_export.py
Created February 9, 2009 15:11
Here is a sample usage of the mwclient API (MediaWiki used with Python)
import mwclient
username = u'WikiSysop'
password = u's3cr3t'
#site = mwclient.Site(('https', host), path = '/mediawiki-1.14.0rc1/')
host = u'tools'
site = mwclient.Site(host, path=u'/mediawiki-1.14.0rc1/')
site.login(username, password)
# Edit page