This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is a simple class based view that require the user login to be displayed | |
It's is intented to be used as a base class for another class based views | |
Use it like this: | |
from django.views.generic import TemplateView | |
from mylib import LoginRequiredView | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This code inserts the placeholder attribute, using the field's label, | |
# for all TextInput, Textarea, DateInput, DateTimeInput, TimeInput widgets | |
# of your ModelForm | |
# | |
class MyForm(forms.ModelForm): | |
class Meta: | |
model = MyModel | |
def __init__(self, *args, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# pip install futures | |
from concurrent import futures | |
import time | |
import random | |
def sleep(me, x): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /usr/bin/time -f '%E - %P%% cpu - %M kbytes ram' python tmp/map.py ~/Desktop >tmp/map.json | |
import hashlib | |
import json | |
import os | |
import sys | |
def get_file_hash(path): | |
h = hashlib.sha256() | |
with open(path, 'rb') as fp: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/sha256" | |
"flag" | |
"fmt" | |
"github.com/gorilla/mux" | |
"hash" | |
"io" | |
"launchpad.net/goamz/aws" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git push | |
Counting objects: 5, done. | |
Delta compression using up to 8 threads. | |
Compressing objects: 100% (3/3), done. | |
Writing objects: 100% (3/3), 328 bytes | 0 bytes/s, done. | |
Total 3 (delta 1), reused 0 (delta 0) | |
remote: Cloning into '/home/application/current'... | |
remote: / | |
remote: requirements.apt not found. | |
remote: Skipping... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $# -lt 2 ]]; then | |
echo "Usage: setup-git-push-deploy.sh hostname project" | |
exit 1; | |
fi | |
host="$1" | |
PROJECT="$2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
$bootstrap = <<SCRIPT | |
apt-get update -yq | |
apt-get install -yq python-software-properties | |
add-apt-repository -y ppa:juju/stable | |
apt-get update -yq | |
apt-get install -yq juju-local | |
echo -e 'y\n' | ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"net/http/httputil" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will setup your server from scratch | |
set -e | |
# Setup Docker | |
curl -sL http://get.docker.io/ | bash | |
docker pull flynn/slugbuilder | |
docker pull flynn/slugrunner |
OlderNewer