Skip to content

Instantly share code, notes, and snippets.

@mkmik
mkmik / gist:1011112
Created June 6, 2011 21:07
real fix
diff -r 0890b1488204 -r 897ba6cc2682 p/clnt/read.go
--- a/p/clnt/read.go Mon Jun 06 17:09:49 2011 +0200
+++ b/p/clnt/read.go Mon Jun 06 22:43:09 2011 +0200
@@ -107,9 +110,9 @@
for b := buf[0:n]; len(b) > 0; {
var d *p.Dir
- d, err = p.UnpackDir(b, file.fid.Clnt.Dotu)
- if err != nil {
- return nil, err
@mkmik
mkmik / demo
Created June 10, 2011 21:31
go md5/sha1 example
$ for a in md5 sha1 ; do ./hash -$a /bin/ls; ${a}sum /bin/ls; echo; done
a3f812b9fe329322a3d6b00722694e84 /bin/ls
a3f812b9fe329322a3d6b00722694e84 /bin/ls
9eb997f16adb828cd0273f24b0ae94d32c5a3b3f /bin/ls
9eb997f16adb828cd0273f24b0ae94d32c5a3b3f /bin/ls
/*
Hash - Guillermo Estrada
Simple utility to obtain the MD5 and/or SHA-1
of a file from the command line.
2011
Edited: Marko Mikulicic 2011
*/
/*
Hash - Guillermo Estrada
Simple utility to obtain the MD5 and/or SHA-1
of a file from the command line.
2011
Edited: Marko Mikulicic 2011
*/
{{{
#!diff
--- /var/lib/dnet/solr/conf/solrconfig.xml 2011-07-11 18:10:50.970025626 +0200
+++ /home/claudio/app/openaire_solr/var/lib/dnet/solr/conf/solrconfig.xml 2011-05-27 12:58:59.000000000 +0200
@@ -31,14 +31,6 @@
-Dsolr.abortOnConfigurationError=false
-->
<abortOnConfigurationError>true</abortOnConfigurationError>
-
class CSquareSerializer extends CSquareHelpers {
case class RelativePoint(val x: Int, val y: Int)
implicit def tuple2relpoint(t: (Int, Int)) = RelativePoint(t._1, t._2)
sealed trait Component
case class CoarseComponent(val q: Int) extends Component
case class FineComponent(val q: Int, val x: Int, val y: Int) extends Component
case class TopComponent(val q: Int, val x: Int, val y: Int) extends Component
def serialize(square: CSquare) = {
assert invocation == [('write', ("usage: nosetests [-h] N [N ...]\n\npositional arguments:\n N an integer for the accumulator\n\noptional arguments:\n -h, --help show this help message and exitX\n",),{})]
"""
======================================================================
FAIL: test_help (opennode.oms.tests.test_cmdline.CmdLineTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/marko/Projects/opennode/opennode-management/opennode/oms/tests/test_cmdline.py", line 20, in test_help
assert invocation == [('write', ("usage: nosetests [-h] N [N ...]\n\npositional arguments:\n N an integer for the accumulator\n\noptional arguments:\n -h, --help show this help message and exitX\n",),{})]
AssertionError:
def providesSubscriptionAdapter(cls):
provideSubscriptionAdapter(cls, adapts=[cls])
return cls
@providesSubscriptionAdapter
class cmd_ls(Cmd):
implements(ICmdArgumentsSyntax)
# ...
def setup_environ():
from grokcore.component.testing import grok
grok('opennode.oms.endpoint.ssh.cmd.grokkers') # XXX: Not sure why this needs to be explicit--an ordering issue?
grok('opennode.oms.security.grokkers') # XXX: Not sure why this needs to be explicit--an ordering issue?
grok('grokcore.security.meta') # invoke the PermissionGrokker which will register groksecurity permissions.
grok('opennode.oms')
OST /stream?after=1337604934980 HTTP/1.1
Host: localhost:8080
X-Requested-With: XMLHttpRequest
["/machines/3c17035c-a9b5-5660-9f3d-a41e98280ef5/interfaces/vnet0/","/machines/3c17035c-a9b5-5660-9f3d-a41e98280ef5/interfaces/vnet1/","/machines/3c17035c-a9b5-5660-9f3d-a41e98280ef5/i
nterfaces/lxcbr0/","/machines/3c17035c-a9b5-5660-9f3d-a41e98280ef5/interfaces/wlan0/","/machines/3c17035c-a9b5-5660-9f3d-a41e98280ef5/interfaces/lo/","/machines/3c17035c-a9b5-5660-9f3d-a41e98280ef5/interfaces/virbr0/","/machines/3c17035c-
a9b5-5660-9f3d-a41e98280ef5/interfaces/eth0/","/machines/3c17035c-a9b5-5660-9f3d-a41e98280ef5/vms/82e8bf80-98de-4a41-a470-f2ebadc3069e/","/machines/dec05233-cc7c-5a8c-8919-d8454bf894ae/","/machines/3c17035c-a9b5-5660-9f3d-a41e98280ef5/vms
/ba9b5f90-d25e-e3da-5a13-dfe96ba42c79/","/machines/3c17035c-a9b5-5660-9f3d-a41e98280ef5/vms/cfb5b174-b86b-867c-90ed-a05ee4e7ecbf/","/machines/3c17035c-a9b5-5660-9f3d-a41e98280ef5/vms/93071a3f-eac1-1f58-53a4-0e2308d48109/","/machines/3c170
35c-a9b5-5660-9f3d-a41e982