Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am buth on github.
  • I am buth (https://keybase.io/buth) on keybase.
  • I have a public key ASDNSWn2sg3l9w5AP0Uc9DFz0Q8VQheJxXrruxNI66HUKwo

To claim this, I am signing this object:

View similarities.js
{
"properties" : {
"name" : "Ayer",
"geometry" : {
"lat" : 42.56,
"lng" : -71.58
},
"city" : "Ayer",
"state" : "MA",
"zipcode" : "01432"
@buth
buth / iterator.go
Last active Feb 22, 2016
Generic Iterator interface and MongoDB implementation
View iterator.go
package iterator
type Iterator interface {
Next() (value interface{}, done bool, err error)
}
@buth
buth / dm.bash
Created Oct 28, 2015
Bash function for setting the Docker machine environment.
View dm.bash
dm() {
status=$(docker-machine status dev)
if [ $? -ne 0 ]; then
echo "Got an error trying to get VM status"
return
fi
case $status in
Stopped)
@buth
buth / Dockerfile
Created Sep 2, 2015
Install PhantomJS
View Dockerfile
ENV PHANTOMJS_VERSION=1.9.8
RUN \
cd /usr/local && \
curl -fLO https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 && \
tar --strip-components 1 -xjf phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin/phantomjs && \
rm phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2
@buth
buth / cloud-config.yml
Created Jul 15, 2015
Autmoatically format and mount a drive with CoreOS Cloud-Config
View cloud-config.yml
#cloud-config
coreos:
units:
- name: format-drive.service
command: start
content: |
[Unit]
Description=Formats the drive
After=dev-xvdc.device
@buth
buth / gist:9fcef2c106e3cc630c16
Created Feb 12, 2015
MongoDB authenticated Replica Set via environment variables
View gist:9fcef2c106e3cc630c16
[Unit]
Description=mongodb
Requires=docker.service
After=docker.service
[Service]
Restart=always
RestartSec=5s
TimeoutStartSec=0
KillMode=none
@buth
buth / Dockerfile
Last active Jan 8, 2022
Docker Install ImageMagick
View Dockerfile
RUN \
curl -sfLO http://www.imagemagick.org/download/ImageMagick-6.9.0-4.tar.gz && \
echo 'cf51a1c6ebf627c627a8e6ac20aecce5f1425907c2cdb98c5a60f329c5c6caf2 ImageMagick-6.9.0-4.tar.gz' | sha256sum -c - && \
tar -xzf ImageMagick-6.9.0-4.tar.gz && \
cd ImageMagick-6.9.0-4 && \
./configure --prefix /usr/local && \
make install && \
cd .. && \
rm -rf ImageMagick*
@buth
buth / gist:65708a902828a464ab54
Created Nov 13, 2014
Cloud-init script for setting up Elastic Search on Ubuntu
View gist:65708a902828a464ab54
#!/bin/bash
echo "127.0.0.1 `hostname`" >> /etc/hosts
apt-get update
apt-get -y upgrade
apt-get -y install openjdk-7-jre
cd /tmp
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.0.deb
dpkg -i elasticsearch-1.1.0.deb
echo 'ES_HEAP_SIZE=6g' >> /etc/default/elasticsearch
echo 'cluster.name: awesomecluster
@buth
buth / cloud-config.yml
Last active May 22, 2016
HTTPS etcd with cloud-config
View cloud-config.yml
#cloud-config
coreos:
update:
reboot-strategy: etcd-lock
etcd:
discovery: https://discovery.etcd.io/<TOKEN>
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
key-file: /etc/etcd-ssl/key.pem