Skip to content

Instantly share code, notes, and snippets.

@ryanobjc
ryanobjc / gist:1584579
Created January 9, 2012 19:47
ruby error
[Mon, 09 Jan 2012 19:45:09 +0000] ERROR: ruby_block[delete_old_plugins] (collectd::default line 65) has had an error
[Mon, 09 Jan 2012 19:45:09 +0000] ERROR: ruby_block[delete_old_plugins] (/var/cache/chef/cookbooks/collectd/recipes/default.rb:65:in `from_file') had an error:
ruby_block[delete_old_plugins] (collectd::default line 65) had an error: Cannot find a resource matching template[/etc/collectd/plugins/vmem.conf] (did you define it first?)
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:115:in `lookup'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:182:in `find_resource_by_hash'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:180:in `each'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:180:in `find_resource_by_hash'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collection.rb:178:in `each'
/usr/lib/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource_collect
@ryanobjc
ryanobjc / shr-table.el
Created March 23, 2019 03:14
example of parsing shr tables
(defun shr-table-to-list (str)
"Turns a chunk of text with 'shr-indentation properties (from the
simple html renderer of tables) into a list of the table data cells"
(let ((pos 0)
(nextpos 0)
(results '())
(strlen (length str)))
(while (and nextpos (< pos strlen))
(setq nextpos (next-single-property-change (1+ pos) 'shr-indentation str))
(if nextpos
The code snippet:
Bootstrap b2 = new Bootstrap();
b2.group(childGroup)
.option(ChannelOption.TCP_NODELAY, true)
.channel(NioSocketChannel.class)
.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast("stringEncoder", new StringEncoder(BufType.BYTE, CharsetUtil.UTF_8));
@ryanobjc
ryanobjc / gist:4008937
Created November 3, 2012 21:37
C vs C++/Java
With languages like Java, or especially C++,” Bornstein says, “abstractions can be convenient, but there
are a lot of implicit operations that happen, such as when copy constructors are invoked, or destructors
or assignment operators, or if you have any sort of operator overloading. Those implicit sort of function
calls, unless you’re an absolute expert in the code base and know exactly how everything was designed,
can actually create real problems when reasoning about a piece of code.
http://dl.acm.org/citation.cfm?doid=2366316.2366321
@ryanobjc
ryanobjc / postinst.sh
Created September 6, 2012 23:16
postinst
#!/bin/sh
if [ -x `which update-rc.d` ] ; then
update-rc.d carbon-cache defaults
else
chkconfig --add carbon-cache
fi
rm /etc/apache2/sites-enables/000-default
ln -sf /opt/graphite/examples/example-graphite-vhost.conf /etc/apache2/sites-enabled/graphite-vhost.conf
@ryanobjc
ryanobjc / pkg-graphite.sh
Created September 6, 2012 21:05
package up graphite using fpm
#!/bin/bash
VER=0.9.10
HERE=`pwd`
apt-get install python-setuptools python-django-tagging python-pysqlite2 python-memcache python-ldap python-django python-cairo-dev
wget https://launchpad.net/graphite/0.9/${VER}/+download/graphite-web-${VER}.tar.gz
wget https://launchpad.net/graphite/0.9/${VER}/+download/carbon-${VER}.tar.gz
#!/bin/sh
VERS=$1
cat > java-post.sh <<EOF
#!/bin/sh
set -e
for i in java javac jps jstack jmap ; do
update-alternatives --install /usr/bin/\$i \$i /usr/lib/jvm/$VERS/bin/\$i 1
#!/bin/bash
JAVAPATH=$1
BN=`basename $JAVAPATH`
if [ ${BN:0:3} != 'jdk' ] ; then
echo "Error, path $JAVAPATH doesnt seem to be a JDK path, which normally starts with 'jdk'"
exit 1
fi
#!/bin/sh
VERS=$1
cat > java-remove.sh <<EOF
#!/bin/sh
set -e
for i in java javac jps jstack jmap ; do
update-alternatives --remove \$i /usr/lib/jvm/$VERS/bin/\$i
diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/main/java/org/apache/hadoop/hb
index 72a73de..d9550c6 100644
--- a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -384,7 +384,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
this.rpcServer = HBaseRPC.getServer(this,
new Class<?>[]{HRegionInterface.class, HBaseRPCErrorHandler.class,
OnlineRegions.class},
- initialIsa.getHostName(), // BindAddress is IP we got for this server.
+ "0.0.0.0",