Skip to content

Instantly share code, notes, and snippets.

View sgarcez's full-sized avatar
🌀
.

Sergio Garcez sgarcez

🌀
.
View GitHub Profile
@sgarcez
sgarcez / imax.py
Created April 22, 2012 19:07
Simple script to check when tickets go on sale at the London IMAX. You can search for multiple films and notify different email addresses.
#!/usr/bin/env python
'''
Simple script to check when tickets go on sale at the London IMAX.
You can search for multiple films and notify different email addresses.
'''
__author__ = 'Sergio Garcez'
import sys, urllib, sched, time, smtplib, logging
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
# from:
# http://serverfault.com/questions/96499/how-to-automatically-start-supervisord-on-linux-ubuntu/259230#259230
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
@sgarcez
sgarcez / inheritance.mako
Created May 4, 2017 10:21
mako conditional inheritance
<%!
def inherit_base(context):
if not context.get('request').is_xhr:
return "./base.mako"
%>
<%inherit file="${inherit_base(context)}"/>
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
// UQueue is a Slice based list implementation of a Queue
{
"code": "TASK_NOT_FOUND",
"message": "Task not found"
}
type InvokeResponse_Error struct {
Message string
Type string
StackTrace []*InvokeResponse_Error_StackFrame
ShouldExit bool
}
func handler(event json.RawMessage) error {
return errors.New(“Uh-oh. Something went wrong”)
}
{
"errorMessage": "Uh-oh. Something went wrong",
"errorType": "errorString"
}
type lambdaError struct {
code string
message string
origErr error
}
func (e lambdaError) Error() string {
b, err := json.Marshal(e)
if err != nil {
{
"errorMessage": "{\"code\":\"TASK_NOT_FOUND\",\"public_message\":\"Task not found\",\"private_message\":\"unknown task: foo-bar\"}",
"errorType": "lambdaError"
}