Skip to content

Instantly share code, notes, and snippets.

"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
@derwolfe
derwolfe / gunicorn-upstart.conf.template
Created May 12, 2012 17:19 — forked from m0n5t3r/gunicorn-upstart.conf.template
template for a gunicorn upstart job that can run several instances of a django application
# %(mysite)s - run %(mysite)s instances (default is the main production instance)
#
# This runs gunicorn-django for %(mysite)s; to install:
# * sudo ln -s <this file> /etc/init/%(mysite)s
# * sudo initctl reload-configuration
#
# it expects the following directory layout:
#
# /home/%(mysite)s/public_html
# \-env -> virtualenv
@derwolfe
derwolfe / app.js
Created October 11, 2012 02:19 — forked from pixelhandler/app.js
Develop a RESTful API Using Node.js With Express and Mongoose - See: http://pixelhandler.com/blog/2012/02/09/develop-a-restful-api-using-node-js-with-express-and-mongoose/
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
@derwolfe
derwolfe / ServiceTest.cs
Last active December 14, 2015 09:29
Setting up testing for ServiceStack 3.9... project. I was having trouble figuring out how to create my test with service stack. After looking at the endpoint tests from the service stack examples I decided to organize my tests using the following layout.
using NUnit.Framework;
using ServiceStack.ServiceClient.Web;
using example_proj.Services;
namespace Tests
{
[TestFixture]
public class ServiceTests
{
private TestAppHost _appHost;
@derwolfe
derwolfe / strace - writes
Last active December 19, 2015 04:28
Armin - This looks to be part of a way. Strace can show all file operations (syscalls).
~ $ strace -e write python test.py
write(3, "0 seconds\n1 seconds\n2 seconds\n3 "..., 144) = 144
+++ exited with 0 +++
#! /bin/sh
# Start from the repository root.
cd ./$(git rev-parse --show-cdup)
# Delete .pyc files and empty directories.
echo "Deleting pyc files."
find . -name "*.pyc" -delete
find . -type d -empty -delete
using Nancy;
using Nancy.Testing;
using Xunit;
using df_nancy.Modules.api;
namespace df_tests.ApiTests
{
public class PositionApiTests
{
[Fact]
@derwolfe
derwolfe / gist:7320407
Last active December 27, 2015 11:39
standalone ping check config
{
"checks": {
"ping_check": {
"handlers": ["default"],
"command": "/etc/sensu/plugins/check-http.rb -p http://www.rmienergy.com",
"interval": 5,
"standalone": true,
}
}
}
angular.module('App', ['restangular'])
.config(function(RestangularProvider) {
RestangularProvider.setBaseUrl('/api');
RestangularProvider.setDefaultHeaders({
"headers": { "common": { "Accept": "application/json" } }
});
})
.service('StaticsService', ['$scope', 'Restangular',
function($scope, Restangular) {
$scope.commodities = Restangular.all('commodities').getList();
var app = angular.module('App', ['restangular']);
app.config(function (RestangularProvider) {
RestangularProvider.setBaseUrl('/api');
RestangularProvider.setDefaultHeaders({
"headers": { "common": { "Accept": "application/json" } }
});
});
// service that fetches all of the static information that will be needed