Skip to content

Instantly share code, notes, and snippets.

View lehrblogger's full-sized avatar

Steven Lehrburger lehrblogger

View GitHub Profile
@lehrblogger
lehrblogger / gist:2522943
Created April 29, 2012 00:49
XMPP XEP-0077 Authenticated In-Band Registration (develop branch), gist #2
diff --git a/examples/register_account.py b/examples/register_account.py
index 17f075a..eeb669d 100644
--- a/examples/register_account.py
+++ b/examples/register_account.py
@@ -39,8 +39,9 @@ class RegisterBot(sleekxmpp.ClientXMPP):
workflows will need to check for data forms, etc.
"""
- def __init__(self, jid, password):
+ def __init__(self, jid, password, to_register):
@lehrblogger
lehrblogger / gist:2553349
Created April 29, 2012 21:28
registration debug output
INFO Account created for admin1@localhost/5406992631335734544375229!
DEBUG SEND (IMMED): </stream:stream>
INFO Waiting for </stream:stream> from server
DEBUG End of stream recieved
DEBUG Waiting for 3 threads to exit.
DEBUG Quitting Scheduler thread
DEBUG Stopped scheduler thread. 2 threads remain.
DEBUG Stopped send thread. 1 threads remain.
DEBUG Could not acquire lock
Done
@lehrblogger
lehrblogger / gist:2657728
Created May 11, 2012 05:39
GUI/sleekxmpp interaction
import logging
from sleekxmpp import ClientXMPP
from sleekxmpp.exceptions import IqError, IqTimeout
class GUIMessageBot(ClientXMPP):
def __init__(self, jid, password, gui_function):
ClientXMPP.__init__(self, jid, password)
@lehrblogger
lehrblogger / gist:3346994
Created August 14, 2012 06:47
virtualenv issues with python-dev in shared Vagrant folder
Last login: Tue Aug 14 02:41:31 on ttys004
~/Desktop/vagrant_test 3949$ ls
~/Desktop/vagrant_test 3950$ vagrant box add base http://files.vagrantup.com/lucid32.box
[vagrant] Downloading with Vagrant::Downloaders::HTTP...
[vagrant] Downloading box: http://files.vagrantup.com/lucid32.box
[vagrant] Extracting box...
[vagrant] Verifying box...
[vagrant] Cleaning up downloaded box...
~/Desktop/vagrant_test 3951$ vagrant init
A `Vagrantfile` has been placed in this directory. You are now
@lehrblogger
lehrblogger / gist:4029114
Created November 7, 2012 01:59
NYT Election Coverage for the Impatient
//In the Javascript console on http://elections.nytimes.com/2012/results/president, paste the following:
NYTD.NYTINT.Bigboard.Bigboard.prototype.render_timer = function() {
// Do nothing if the board isn't live.
if (!this.is_live()) {
return false;
}
// If we've counted to zero, re-load the data.
// Otherwise, decrement the counter.
@lehrblogger
lehrblogger / gist:4211296
Created December 5, 2012 01:44
"[Errno 30] Read-only file system" from virtualenv in vagrant shared folder
vagrant@lucid32:/vagrant$ virtualenv test0
New python executable in test0/bin/python
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 9, in <module>
load_entry_point('virtualenv==1.8.4', 'console_scripts', 'virtualenv')()
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 964, in main
never_download=options.never_download)
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1065, in create_environment
site_packages=site_packages, clear=clear))
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1485, in install_python
@lehrblogger
lehrblogger / gist:4254586
Created December 11, 2012 00:13
gevent sleekxmpp error
(xmpp-env)vagrant@lucid32:/vagrant/xmpp-env/xmpp$ python leaf_component.py
Traceback (most recent call last):
File "leaf_component.py", line 14, in <module>
import sleekxmpp
File "/vagrant/xmpp-env/lib/python2.6/site-packages/sleekxmpp/__init__.py", line 9, in <module>
from sleekxmpp.basexmpp import BaseXMPP
File "/vagrant/xmpp-env/lib/python2.6/site-packages/sleekxmpp/basexmpp.py", line 22, in <module>
from sleekxmpp import plugins, features, roster
File "/vagrant/xmpp-env/lib/python2.6/site-packages/sleekxmpp/roster/__init__.py", line 9, in <module>
from sleekxmpp.xmlstream import JID
@lehrblogger
lehrblogger / lehrblogger
Last active December 10, 2015 02:48
Trying to figure out proper environment and cookbook attribute syntax for Chef
# In my environment json file:
"default_attributes": {
"source_dir": "/vagrant/source_dir"
},
# When I look in the list of attributes at https://manage.opscode.com/nodes/[node_name],
# I see the 'source_dir' attribute, so far so good.
# Then, in my cookbook's default.rb attributes file:
default['mycookbook']['dir'] = "#{default[:source_dir].to_s}/mycookbook"
Expected process to exit with [0], but received '128'
---- Begin output of git ls-remote [email protected]:lehrblogger/myrepo.git mybranch ----
STDOUT:
STDERR: Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
---- End output of git ls-remote [email protected]:lehrblogger/myrepo.git mybranch ----
Ran git ls-remote [email protected]:lehrblogger/myrepo.git mybranch returned 128
In my Chef cookbook:
["/home/vagrant/test", "/home/vagrant/test/subtest"].each do |dir|
Chef::Log.info(dir)
directory dir do
owner "vagrant"
group "vagrant"
mode 0644
recursive true
action :create
end