Skip to content

Instantly share code, notes, and snippets.

@ryanobjc
ryanobjc / shr-table.el
Created Mar 23, 2019
example of parsing shr tables
View shr-table.el
(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
ryanobjc / docker session
Created Sep 30, 2014
docker crash when denied network connection via boot2docker and little snitch (OS X)
View docker session
$ 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
View gist:5629767
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));
View gist:4008937
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
View postinst.sh
#!/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 Sep 6, 2012
package up graphite using fpm
View pkg-graphite.sh
#!/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
View generate-java-remove.sh
#!/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
View generage-java-post.sh
#!/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
View build-java.sh
#!/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
View gist:3108189
#!/bin/sh
HOSTS="a b c d e"
echo `hostname`
for i in $HOSTS ; do
host $i
done
You can’t perform that action at this time.