Skip to content

Instantly share code, notes, and snippets.

View camsom's full-sized avatar

Cameron Lowe camsom

View GitHub Profile

List

{
  "fields": {
    "title": {
      "type": "string",
      "required": True,
      "read_only": False,
      "max_length": 512
db:
image: orchardup/postgresql
ports:
- 5432
web:
build: .
command: python manage.py runserver 0.0.0.0:49001 --settings=reputationconsole.local_settings
volumes:
- .:/project_root
ports:
def by_ten(x):
return x * 10
print by_ten(4)
# output should be 40
class Post(object):
def __init__(self, *args, **kwargs):
self.created_time = kwargs.pop("created_time")
self.author = kwargs.pop("from")["name"]
self.message = kwargs.pop("message", "")
self.link_url = kwargs.pop("link", "")
self.picture_url = kwargs.pop("picture", "")
self.description = kwargs.pop("description", "")
self.is_comment = kwargs.pop("is_comment", False)
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.13.81"
config.vm.network "forwarded_port", guest: 8100, host: 8100
config.vm.synced_folder "../../", "/vagrant/"
config.vm.provision "shell",
config.vm.provision "shell",
inline: "apt-get -y update && apt-get -y install docker.io"
config.vm.provision "shell",
ERROR_FUNCTION = '''
CREATE OR REPLACE FUNCTION erf(x decimal) RETURNS decimal AS $$
DECLARE a1 decimal = 0.254829592;
DECLARE a2 decimal = -0.284496736;
DECLARE a3 decimal = 1.421413741;
DECLARE a4 decimal = -1.453152027;
DECLARE a5 decimal = 1.061405429;
DECLARE p decimal = 0.3275911;
DECLARE sign integer = 1;
DECLARE t decimal;
from django.template.loader import render_to_string
import boto
from stakeholder.models import *
from message.utils import SendEmailMixin
CONFIRMATION_SUBJECT = 'Activate your account with NextTier'
CONFIRMATION_TEMPLATE = 'email/confirm.txt'
CONFIRMATION_TEMPLATE_HTML = 'email/confirm.html'
# build
sudo docker build -t pokerap .
# run
sudo docker run -v /dev/log:/dev/log pokerap /go/bin/gokerap
# check syslog
sudo tail /var/log/syslog
# here are the cool lines I like
@camsom
camsom / gist:3f9052fae8f75963bb07
Created October 16, 2014 17:55
Dockerfile for my dump go project
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install -y curl git bzr
RUN curl -s https://go.googlecode.com/files/go1.2.linux-amd64.tar.gz | tar -v -C /usr/local/ -xz
ENV PATH /usr/local/go/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
ENV GOPATH /go
ENV GOROOT /usr/local/go
SELECT * FROM date_table WHERE rankscore();
CREATE FUNCTION rank_score() RETURNS decimal as $$
BEGIN
return date_table.birthday + interval '50 days'
END; $$