Steps with explanations to set up a server using:
- Virtualenv
- Virtualenvwrapper
- Django
- Gunicorn
| import sys | |
| class ParseError(ValueError): | |
| pass | |
| class Regex(object): | |
| def __init__(self, tree): | |
| self.tree = tree |
| import threading | |
| # Based on tornado.ioloop.IOLoop.instance() approach. | |
| # See https://github.com/facebook/tornado | |
| class SingletonMixin(object): | |
| __singleton_lock = threading.Lock() | |
| __singleton_instance = None | |
| @classmethod |
| package main; | |
| import ( | |
| "fmt" | |
| "math/rand" | |
| "time" | |
| ) | |
| var ( | |
| Web1 = fakeSearch("web1") |
| // Simple example of client. | |
| // Client prints received messages to stdout and sends from stdin. | |
| #include <errno.h> | |
| #include <fcntl.h> | |
| #include <stdio.h> | |
| #include <signal.h> | |
| #include <unistd.h> | |
| #include <sys/select.h> | |
| #include <netinet/in.h> |
| // Heapsort with Java | |
| // Heap properties: | |
| // Left child of h[i] is h[2i + 1] (given 2i + 1 < h.size) | |
| // Right child of h[i] is h[2i + 2] (given 2i + 2 < h.size) | |
| // parent of h[i] is h[(i-1)/2] (given i > 0) | |
| public class Heap { | |
| int[] heap; | |
| int size; |
| # Start the old vagrant | |
| $ vagrant init centos-6.3 | |
| $ vagrant up | |
| # You should see a message like: | |
| # [default] The guest additions on this VM do not match the install version of | |
| # VirtualBox! This may cause things such as forwarded ports, shared | |
| # folders, and more to not work properly. If any of those things fail on | |
| # this machine, please update the guest additions and repackage the | |
| # box. |
| /* | |
| iflist.c : retrieve network interface information thru netlink sockets | |
| (c) Jean Lorchat @ Internet Initiative Japan - Innovation Institute | |
| v1.0 : initial version - Feb 19th 2010 | |
| This file was obtained at the following address : | |
| http://www.iijlab.net/~jean/iflist.c |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <uv.h> | |
| #include <curl/curl.h> | |
| uv_loop_t *loop; | |
| CURLM *curl_handle; | |
| uv_timer_t timeout; | |
| typedef struct curl_context_s { |
| class Automaton: | |
| def __init__(self, nstates): | |
| self.transitions = [{} for i in range(nstates)] | |
| self.accept_states = [False] * nstates | |
| def register(self, source_state, char, target_state): | |
| self.transitions[source_state][char] = target_state | |
| def register_accept(self, state): | |
| self.accept_states[state] = True |