Skip to content

Instantly share code, notes, and snippets.

@speier
speier / pre-push.sample
Created October 8, 2013 14:23
git's default pre-push sample
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
@speier
speier / EmbeddedResourceTypes.cs
Created July 19, 2013 09:16
ASP.NET MVC embedded views and virtual path provider
using System.Collections.Generic;
using System.IO;
namespace Portal.Common.EmbeddedResources
{
public static class EmbeddedResourceTypes
{
public static string GetContentType(string path)
{
return MimeTypes[Path.GetExtension(path)];
@speier
speier / gist:5974014
Created July 11, 2013 09:32
install redis-server via ppa
1. apt-get install software-properties-common
2. add-apt-repository ppa:chris-lea/redis-server
3. apt-get update
4. apt-get install redis-server
@speier
speier / steps
Last active December 19, 2015 14:59
install lastest stable nginx package on ubuntu raring
1. wget http://nginx.org/keys/nginx_signing.key
2. apt-key add nginx_signing.key
3. nano /etc/apt/sources.list
paste `deb http://nginx.org/packages/ubuntu/ raring nginx`
paste `deb-src http://nginx.org/packages/ubuntu/ raring nginx`
4. apt-get update
5. apt-get install nginx
@speier
speier / 1. on the server
Last active December 19, 2015 13:49
experimenting with git powered deployment
01. `apt-get install git`
02. `adduser git`
03. `visudo` add `git ALL=(ALL:ALL) NOPASSWD: ALL` to user privilege specification
04. `login git`
05. `ssh-keygen -t rsa`
06. `mkdir project`
07. `mkdir project.git`
08. `cd project.git`
09. `git init --bare`
10. `cd hooks`
@speier
speier / gist:5964332
Created July 10, 2013 08:04
List systemd symbolic links on Archlinux:
ls -la /etc/systemd/system/multi-user.target.wants/

Backend Architectures

ARCHITECTURES

ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats

@speier
speier / Program.cs
Created December 13, 2012 15:54
The first term in the Fibonacci sequence to contain 2012 digits.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
namespace ConsoleApplication4
{
class Program
{
@speier
speier / app.js
Created October 2, 2012 11:34 — 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');
@speier
speier / api.js
Created September 14, 2012 20:07 — forked from fwielstra/api.js
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');