Skip to content

Instantly share code, notes, and snippets.

View hub-cap's full-sized avatar

Michael Basnight hub-cap

View GitHub Profile
def _gen_ports(portstr):
from_port, sep, to_port = portstr.partition('-')
if not to_port:
if not sep:
to_port = from_port
else:
# This is an invalid configuration, such as "1-",
# so the port will be set to 0, which is generally
# not going to be seen as valid.
to_port = 0
>>> def check_portstr(portstr):
... from_port, sep, to_port = portstr.partition('-')
... if not to_port:
... if not sep:
... to_port = from_port
... else:
... raise Exception("onoes")
... return from_port, to_port
...
>>> check_portstr("1-2")
@hub-cap
hub-cap / gist:8964433
Created February 12, 2014 21:01
i totally stole this from someone!
;; Buffer indention stuff, either indent region or buffer w/ a C-M-\
(defun indent-buffer ()
"Indent the currently visited buffer."
(interactive)
(indent-region (point-min) (point-max)))
(defun indent-region-or-buffer ()
"Indent a region if selected, otherwise the whole buffer."
(interactive)
(save-excursion
(defun snip-reply (b e)
"remove selected lines, and replace with a snip"
(interactive "r")
(delete-region b e)
(insert "> [...]\n" ))
;; Shortcut for offlineimap.el running
(eval-after-load "gnus"
'(progn
(define-key gnus-group-mode-map (kbd "v g")
(lambda ()
(interactive)
(offlineimap)))))
;; Add a hook to get news after offlineimap is finished
(add-hook 'offlineimap-event-hooks (lambda (msg-type &optional action)
[general]
pythonfile = ~/.offlineimap.py
accounts = gmail
[Account gmail]
localrepository = gmail-local
remoterepository = gmail-remote
status_backend = sqlite
[Repository gmail-local]
Section "InputClass"
Identifier "touchpad peppy cyapa"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
MatchProduct "cyapa"
Option "FingerLow" "10"
Option "FingerHigh" "10"
EndSection
21:51 -!- hub_cap [[email protected]]
21:51 -!- ircname : Michael Basnight
21:51 -!- channels : #openstack-meeting-alt #openstack-infra @#trove-core-super-secret #openstack-trove
21:51 -!- server : asimov.freenode.net [TX, USA]
21:51 -!- away : intermission
21:51 -!- hostname : 162.209.127.37 162.209.127.37
21:51 -!- idle : 0 days 0 hours 0 mins 7 secs [signon: Thu Jan 16 04:12:21 2014]
21:51 -!- account : hub_cap
21:51 -!- End of WHOIS
2014-01-23 02:27:48.670 DEBUG trove.common.wsgi [req-ca5e4f43-f7ba-4360-a2e0-1c7f7a9d6bb8 f58950e1cda44b5d8ef81591898c8efb 5f4950fa1da540be974dee6c3eae664c] Getting schema for type:show from (pid=1849) get_schema /opt/stack/trove/trove/common/wsgi.py:416
2014-01-23 02:27:48.669 DEBUG routes.middleware [-] Match dict: {'action': u'show', 'tenant_id': u'5f4950fa1da540be974dee6c3eae664c', 'controller': <trove.common.wsgi.Resource object at 0x378b4d0>, 'id': u'1'} from (pid=1849) __call__ /usr/lib/python2.7/dist-packages/routes/middleware.py:103
baz@killxml:/opt/stack/cinder$ cinder type-create lvm
+--------------------------------------+------+
| ID | Name |
+--------------------------------------+------+
| a7f42472-bc32-4f13-a581-e12f4166bb11 | lvm |
+--------------------------------------+------+
baz@killxml:/opt/stack/cinder$ cinder type-create lvmcinder type-key lvm set volume_backend_name=LVM_iSCSI^C
baz@killxml:/opt/stack/cinder$ ^C
baz@killxml:/opt/stack/cinder$ cinder type-key lvm set volume_backend_name=LVM_iSCSI
baz@killxml:/opt/stack/cinder$ cinder extra-specs-list