Skip to content

Instantly share code, notes, and snippets.

View notmyname's full-sized avatar

John Dickinson notmyname

View GitHub Profile
@notmyname
notmyname / gist:7494398
Created November 16, 2013 00:57
download a file slowly. use a IMB file
#!/usr/bin/env python
from httplib import HTTPConnection as Connection
import time
import sys
# send data
conn = Connection('saio:8080') # example.com:8090
conn.request('GET', '/v1/AUTH_test/c/big', headers={})
resp = conn.getresponse()
@notmyname
notmyname / theme.js
Last active December 27, 2015 03:39
Javascript to put the topic at the top of the window in LimeChat. Name this file <Theme>.js, where "<Theme>" is replaced by the name of the theme you are using. Put the file into your LimeChat themes folder (there's a button to open this folder in the LimeChat preferences). Originally from https://github.com/gholt/tcod/blob/master/LimeChat%20The…
function processLine(e) {
var line = e.target;
switch (line.getAttribute("_type")) {
case "reply":
case "topic":
var textnode = line.lastChild.firstChild;
if (textnode.nodeValue.substr(1, 5) == "opic:" ||
textnode.nodeValue.indexOf("has set topic:") >= 0) {
var newdiv = document.createElement("div");
newdiv.setAttribute("id", "thetopic");
@notmyname
notmyname / gist:6032928
Created July 18, 2013 20:46
git config settings
$ git config --list
credential.helper=osxkeychain
user.name=John Dickinson
user.email=me@not.mn
color.ui=always
alias.st=status
alias.ci=commit
alias.co=checkout
alias.staged=diff --cached
alias.unstaged=diff
diff --git a/doc/source/overview_replication.rst b/doc/source/overview_replication.rst
index 2db17d5..4d3803a 100644
--- a/doc/source/overview_replication.rst
+++ b/doc/source/overview_replication.rst
@@ -2,48 +2,118 @@
Replication
===========
-Since each replica in swift functions independently, and clients generally require only a simple majority of nodes responding to consider an operation successful, transient failures like network partitions can quickly cause replicas to diverge. These differences are eventually reconciled by asynchronous, peer-to-peer replicator processes. The replicator processes traverse their local filesystems, concurrently performing operations in a manner that balances load across physical disks.
-
@notmyname
notmyname / gist:4946922
Created February 13, 2013 18:33
how 2 python?
def foo(x, y=None, *a, **kw):
print '%r, %r, %r, %r' % (x, y, a, kw)
foo(1)
foo(1, 2)
foo(1, 2, 3, 4, 5, bar=6)
foo(1, 2, y=3) # want: 1, 3, (2,), {}
@notmyname
notmyname / example.txt
Created November 24, 2015 22:45
example of new reverse listings in swift
Last login: Tue Nov 24 14:41:49 on ttys001
john>europa>~>$ testtoken | pbcopy
john>europa>~>$ curl -i -H "X-Auth-Token: xxx" http://saio:8080/v1/AUTH_test/
HTTP/1.1 204 No Content
Content-Type: text/plain; charset=utf-8
X-Account-Object-Count: 0
X-Timestamp: 1448404927.22093
X-Account-Bytes-Used: 0
X-Account-Container-Count: 0
X-Put-Timestamp: 1448404927.22093
john@openslice:~/swift$ rm -r .tox
john@openslice:~/swift$ tox
____________________________________________________________________ [tox sdist] _____________________________________________________________________
[TOX] ***creating sdist package
[TOX] /home/john/swift$ /usr/bin/python setup.py sdist --formats=zip --dist-dir .tox/dist >.tox/log/0.log
[TOX] ***copying new sdistfile to '/home/john/.tox/distshare/swift-1.7.3.zip'
Traceback (most recent call last):
File "/usr/local/bin/tox", line 9, in <module>
load_entry_point('tox==1.3', 'console_scripts', 'tox')()
File "/usr/local/lib/python2.6/dist-packages/tox/_cmdline.py", line 19, in main
$ ssh s.not.mn
Linux openslice 2.6.35.4-rscloud #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux
Ubuntu 10.04.4 LTS
Welcome to Ubuntu!
* Documentation: https://help.ubuntu.com/
Last login: Fri Sep 21 23:17:11 2012 from 75-101-56-125.dsl.static.sonic.net
john@openslice:~$ cd swift
john@openslice:~/swift$ nosetests test/unit/proxy/test_server.py:TestObjectController.test_leak_1
Instead of:
line = 'Sep 16 20:00:02 ',srv,' testsrv ', \
'199.115.119.21 - 16/Sep/2012/20/00/02 GET ',obj, \
' HTTP/1.0 200 - StaticWeb - - 17005 - ',txn,' - 0.0095 -'
stream = ["".join(line)]
How about:
stream = 'Sep 16 20:00:02 srv testsrv 199.115.119.21 - ' \
Last login: Tue Sep 11 19:42:36 2012 from 10.0.1.100
OpenIndiana (powered by illumos) SunOS 5.11 oi_151a6 September 2012
$ python
Python 2.6.4 (r264:75706, Apr 17 2011, 11:24:50) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes, ctypes.util
>>> libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
>>> sys_fallocate = getattr(libc, 'fallocate')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>