Skip to content

Instantly share code, notes, and snippets.

View c4milo's full-sized avatar
:octocat:

Camilo Aguilar c4milo

:octocat:
View GitHub Profile
package main
import "log"
var i int
func bsearch(target int, array []int) int {
low := 0
hi := len(array)
git log --pretty="format:%an %ae" | sort | uniq -i | sort | sed -e 's/^ *[0-9]* //g' > AUTHORS
// Package mailer wraps Mandrill's REST API only for sending emails using templates.
package mailer
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
#!/bin/bash
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
name=`echo "$branch" | sed 's|remotes/origin/||'`
git branch --track "${name}" "$branch"
done
// GetByID returns an Account instance given its id which is either:
// username or email.
func (r *RepoPostgres) GetByID(id string) (*Account, error) {
a := new(account)
err := r.db.Get(a, "SELECT * FROM accounts WHERE username = $1 OR email = $1", id)
if err != nil {
return nil, translateError(err)
}
a.Account.PictureURL, _ = url.Parse(a.PictureURL)
@c4milo
c4milo / Go Code of Conduct
Created February 22, 2015 03:56
Golang Code of Conduct
A member of the Go community is:
Open
Members of the community are open to collaboration, patches, problems, or
otherwise. We're receptive to constructive comment and criticism, as the
experiences and skill sets of other members contribute to the whole of our
efforts. We're accepting of all who wish to take part in our activities,
fostering an environment where anyone can participate and everyone can make a
difference.
FROM ubuntu-debootstrap:14.04
RUN echo 'deb http://archive.ubuntu.com/ubuntu trusty main' >/etc/apt/sources.list
RUN echo 'deb http://archive.ubuntu.com/ubuntu trusty-security main' >>/etc/apt/sources.list
RUN echo 'deb http://archive.ubuntu.com/ubuntu trusty-updates main' >>/etc/apt/sources.list
RUN echo 'deb http://archive.ubuntu.com/ubuntu trusty universe' >>/etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y --force-yes \
@c4milo
c4milo / e.go
Created January 19, 2015 18:04
func main() {
var logWriter io.Writer
if config.LogFilePath != "" {
var err error
logWriter, err = os.OpenFile(config.LogFilePath, os.O_RDWR|os.O_APPEND, 0660)
if err != nil {
log.Printf("[WARN] %v", err)
}
}
install_oem_package() {
local oem_pkg=$(_get_vm_opt OEM_PACKAGE)
local oem_use=$(_get_vm_opt OEM_USE)
#local oem_tmp="${VM_TMP_DIR}/oem"
if [[ -z "${oem_pkg}" ]]; then
return 0
fi
info "Installing ${oem_pkg} to OEM partition"

Digesting VMDK spec

Particularly, virtual disks types are very confusing. This document is an attempt to disentangle that and make easier the design of an implementation.

Flat or preallocated disk

  • Monolithic or one-file: Single flat extent with separate descriptor file. createType: monolithicFlat
  • Split or multiple files: 2gb preallocated extents or smaller, to account for file system limits. createType: 2GbMaxExtentFlat
  • VMFS (managed):
    • Zeroed: Thick (flat) disk on VMFS, with blocks zeroed on first use. createType: vmfsPreallocated