Skip to content

Instantly share code, notes, and snippets.

View mpobrien's full-sized avatar
🏄‍♂️
hi please

mpobrien

🏄‍♂️
hi please
View GitHub Profile
import pymongo
# TODO have this file take the contents of the .yml file and put it into the project_ref file.
db = pymongo.Connection()["mci_dev"]
collection = db["project_ref"]
local_config_file = open("config_dev/project/sample.yml")
local_config = "\n".join(local_config_file.readlines())
db.project_ref.update({"identifier" : "sample"}, {"identifier" : "sample", "owner_name": "mpobrien", "branch_name": "master",
"repokind": "github", "enabled": True, "repo_name": "sample",
<div> hello world</div>
//getMax
//getPctDiff
//getSampleComparison
//getCommits
//
//
console.log("loading from rawgit! 3")
/*
{
"name": "perf",
#!/usr/bin/env python
# coding: utf-8
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
import itertools
import boto
import pymongo
db = pymongo.Connection()['mci']
ec2 = boto.connect_ec2()
chain = itertools.chain.from_iterable
all_instances = list(chain([res.instances for res in ec2.get_all_instances()]))
all_instance_ids = set(instance.id for instance in all_instances)
@mpobrien
mpobrien / gist:172b78a8d0a5a8904695
Last active August 29, 2015 14:18
mgo unstable - test case
package main
import (
"fmt"
"gopkg.in/mgo.v2"
)
func main() {
// connect to mongod
sess, err := mgo.Dial("localhost:33333")
@mpobrien
mpobrien / mountrouter.go
Last active August 29, 2015 14:15
mux routing mount experiment
package main
import "net/http"
import "fmt"
import "github.com/gorilla/mux"
func HomeHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("home!"))
}
package main
import (
"bytes"
"code.google.com/p/go.crypto/ssh"
"fmt"
"io/ioutil"
"os"
"time"
)
@mpobrien
mpobrien / querywatch.go
Created September 16, 2014 18:07
query watcher
package main
import "flag"
import "labix.org/v2/mgo"
import "labix.org/v2/mgo/bson"
import "fmt"
import "time"
import "encoding/json"
type ProfileOp struct {
// Dump a cursor to BSON, from inside shell
// db.users.find({"username":"ian"}).dump("/tmp/users.bson")
// cursor options work: skip(), limit(), readpref, etc.
// Restore a collection from BSON, inside shell
// db.users.restore("/tmp/users.bson")
// You can dump aggregation data too
// db.users.aggregate({$group:{_id:"location", count:{$sum:1}}}).dump('/tmp/users_by_loc.bson')