Skip to content

Instantly share code, notes, and snippets.

View jcelliott's full-sized avatar

Joshua C Elliott jcelliott

View GitHub Profile
@jcelliott
jcelliott / gist:4119659
Created November 20, 2012 18:01
ValidationError
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/list/item/add/
Django Version: 1.4.2
Python Version: 2.6.5
Installed Applications:
('django.contrib.auth',
#!/usr/bin/env bash
# ~/bin/home
# toggles source control on my home directory
# idea from [http://rhodesmill.org/brandon/2012/home-directory-vc/]
# colorized output
function cinfo() {
echo -e "\x1b[32m$1\x1b[0m" # green
}
function cwarn() {
package main
import "fmt"
type Vehicle struct{}
func (v Vehicle) Move() {
fmt.Println("vehicle moving")
}
package main
import "fmt"
type Vehicle struct{}
func (v Vehicle) Move() {
fmt.Println("vehicle moving")
}
package main
import "fmt"
type Quacker interface {
Quack()
}
type Duck struct{}
package main
func work(id int, done chan int) {
println("processing top secret document:", id)
done <- id
}
func main() {
done := make(chan int, 5)
for i := 0; i < 5; i++ {
import argparse
import fileinput
def find_alliteration(line, smallest_seq):
# print("examining line: "+line)
seq = 1
words = line.split()
letter = words[0][0]
# print("looking for: "+letter)
for word in words[1:]:
@jcelliott
jcelliott / launch_requestbin.py
Created January 23, 2014 00:03 — forked from glenbot/launch_requestbin.py
Bootstrap file to run Requestbin locally
import os
from requestbin import app
from requestbin.storage.memory import MemoryStorage
app.config['bind_address'] = ('0.0.0.0', int(os.environ.get("PORT", 5000)))
app.config['ignore_headers'] = """
X-Varnish
X-Forwarded-For
X-Heroku-Dynos-In-Use
X-Request-Start
@jcelliott
jcelliott / proxy.go
Last active September 6, 2017 06:58
Reverse proxy using Go
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
def authorized_for(user, op):
if user[1] == 'admin':
return True
else:
return False
def forbidden():
print('forbidden!')
def check_authorized(operation):