Skip to content

Instantly share code, notes, and snippets.

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
ryanobjc / docker session
Created September 30, 2014 23:06
docker crash when denied network connection via boot2docker and little snitch (OS X)
$ docker pull centos:centos7
Pulling repository centos
a5fd0258f31c: Pulling fs layer
511136ea3c5a: Download complete
0b2c58b208cf: Download complete
2014/09/30 16:03:13 unexpected EOF
The code snippet:
Bootstrap b2 = new Bootstrap();
.option(ChannelOption.TCP_NODELAY, true)
.handler(new ChannelInitializer<SocketChannel>() {
protected void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast("stringEncoder", new StringEncoder(BufType.BYTE, CharsetUtil.UTF_8));
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.
ryanobjc /
Created September 6, 2012 23:16
if [ -x `which update-rc.d` ] ; then
update-rc.d carbon-cache defaults
chkconfig --add carbon-cache
rm /etc/apache2/sites-enables/000-default
ln -sf /opt/graphite/examples/example-graphite-vhost.conf /etc/apache2/sites-enabled/graphite-vhost.conf
ryanobjc /
Created September 6, 2012 21:05
package up graphite using fpm
apt-get install python-setuptools python-django-tagging python-pysqlite2 python-memcache python-ldap python-django python-cairo-dev
cat > <<EOF
set -e
for i in java javac jps jstack jmap ; do
update-alternatives --remove \$i /usr/lib/jvm/$VERS/bin/\$i
cat > <<EOF
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
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
HOSTS="a b c d e"
echo `hostname`
for i in $HOSTS ; do
host $i