Steps with explanations to set up a server using:
- virtualenv
- Django
- nginx
- uwsgi
#!/bin/sh | |
git status | grep 'modified\|added' | awk '{system("pyflakes "$3)}' | |
git status | grep 'modified\|added' | awk '{system("pep8 "$3)}' |
#!/usr/bin/env python | |
import subprocess | |
import argparse | |
parser = argparse.ArgumentParser(description='Do the symbolic for you.') | |
parser.add_argument('--source', dest='folder', | |
help='Your code directory') | |
parser.add_argument('--virtual', dest='vfolder', |
""" | |
Permulation algorithm implemented in Python. | |
""" | |
array = range(1, 4) | |
def perm(array, lower, upper): | |
if lower >= upper: | |
print array | |
else: |
#include <stdio.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
int main(int argc, char *argv[]) | |
{ | |
int fd, fdw; | |
int pid; | |
pid = fork(); |
# Extracted information from below | |
# http://rbgeek.wordpress.com/2012/05/11/how-to-add-2nd-hard-drive-to-ubuntu/ | |
# http://ubuntuforums.org/showthread.php?t=1659376 | |
# 1. List out all the disk you have in hand now. | |
sudo fdisk -l | |
# 2. Create partition on the secondary hard drive. | |
# Remember to create logical partition. | |
sudo fdisk /dev/sdb |
#include <stdio.h> | |
#include <stdlib.h> | |
int binary_search(int a[], int min, int max, int value) | |
{ | |
if (max < min) { | |
return -1; | |
} | |
int mid = (max + min) / 2; | |
if (value == a[mid]) { |
#!/usr/bin/python | |
""" | |
Binary Search | |
""" | |
def bsearch(array, min, max, target): | |
if max < min: | |
return -1 |
def get_anagram(big_phrase, phrase): | |
""" | |
Get a sub-string from a big phrase which is the anagram | |
with the other string. | |
""" | |
print 'Problem: ', big_phrase, phrase | |
big_phrase = big_phrase.lower() | |
phrase = phrase.lower().replace(' ', '') | |
for i in range(len(big_phrase)): |
#include <unistd.h> | |
#include <stdio.h> | |
#include <dirent.h> | |
#include <string.h> | |
#include <sys/stat.h> | |
#include <stdlib.h> | |
void printdir(char *dir, int depth) | |
{ | |
DIR *dp; |