Skip to content

Instantly share code, notes, and snippets.

View pokstad's full-sized avatar

Paul Okstad pokstad

View GitHub Profile
@pokstad
pokstad / gist:9882305
Created March 31, 2014 00:05
Install CouchDB 1.5 on Ubuntu 12.04 LTS 64-bit Server
# satisfy dependencies
sudo apt-get -y update
sudo apt-get -y install curl
sudo apt-get -y build-dep couchdb
sudo apt-get -y install libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool erlang-eunit erlang-os-mon erlang-nox g++
# get source code, build, and install
wget http://mirrors.gigenet.com/apache/couchdb/source/1.5.0/apache-couchdb-1.5.0.tar.gz
tar -zxvf apache-couchdb-1.5.0.tar.gz
cd apache-couchdb-1.5.0
./configure
@pokstad
pokstad / couchdbosdaemon.py
Last active August 29, 2015 14:02
CouchDB OS Daemon Demo
#!/usr/bin/python
"""
This script demonstrates how a CouchDB OS Daemon can be written in Python.
For more information on CouchDB OS Daemons, please read here:
http://couchdb.readthedocs.org/en/latest/config/externals.html
"""
import json
import sys
@pokstad
pokstad / couchdbreverseproxy.go
Last active August 29, 2015 14:19
CouchDB Reverse Proxy in Go
package main
import (
"net/http"
"net/url"
"net/http/httputil"
"github.com/pokstad/go-couchdb/couchdaemon"
"github.com/pokstad/go-couchdb"
"time"
"sync"
#!/bin/bash
# --- Version history ---
# 0.4: added variable to store file path, and $2 for base file name
# added variable to store desired reporting interval
# 0.3: added $1 to send in process ID at run time.
# 0.2: switched to $SECONDS for the loop. works.
# 0.1: didn't work well at all.
# --- Version history ---
# Usage: cputrack [PID] [filename]
@pokstad
pokstad / Dockerfile
Last active August 29, 2015 14:23
Sample App for Google's Managed VM service
# Dockerfile extending the generic Go image with application files for a
# single application.
FROM gcr.io/google_appengine/golang
COPY . /go/src/app
RUN go-wrapper download
RUN go-wrapper install -tags appenginevm
@pokstad
pokstad / app.yaml
Last active August 29, 2015 14:23
Google App Engine Sandbox Module for Dispatch Demo
# make sure to replace "projectid" below with the project ID configured in the Google Developer Console
application: projectid
version: 1
runtime: go
api_version: go1
module: module2
handlers:
- url: /.*
script: _go_app
@pokstad
pokstad / sslist.go
Created August 14, 2013 16:31
Singly Linked List in GO
package main
import "fmt"
type LLNode struct {
data string
next *LLNode
}
type LList struct {
@pokstad
pokstad / dirtocouch.py
Created December 17, 2013 00:54
Quick and dirty script for uploading the contents of a directory to a single CouchDB document
#!/usr/bin/python
'''
This script will upload the contents of a directory to a document in
CouchDB. It preserves all of the directory structures and is great
for uploading static websites to be served from CouchDB.
'''
import tkFileDialog
import couchdbkit
import os
import sys
@pokstad
pokstad / anything.pb.go
Last active April 10, 2017 04:03
Protobuf and generate Go code for protobuf definition demonstrating any.Any usage
// Code generated by protoc-gen-go.
// source: anything.proto
// DO NOT EDIT!
/*
Package anything is a generated protocol buffer package.
It is generated from these files:
anything.proto
@pokstad
pokstad / anything.proto
Created April 10, 2017 04:04
A protobuf defintion to demonstrate any.Any
syntax = "proto3";
package anything;
import "google/protobuf/any.proto";
message AnythingForYou {
google.protobuf.Any anything = 1;
}